Skip to content

Commit

Permalink
Merge branch 'vim'
Browse files Browse the repository at this point in the history
  • Loading branch information
genoma committed Feb 11, 2015
2 parents a8fce72 + 4938b99 commit 415c058
Show file tree
Hide file tree
Showing 16 changed files with 117 additions and 16 deletions.
7 changes: 7 additions & 0 deletions .hgtags
Original file line number Diff line number Diff line change
Expand Up @@ -3345,3 +3345,10 @@ d129b939a19065a0a5302077d2a9737ed2dc0bf0 v7-4-618
1ffe91b5e51408d9f68ed8651bb3a85f68365ad1 v7-4-620
f884a1140a0a143ad21b08166e2b72dd131b78c2 v7-4-621
599112d00aa96072d75b1d6a5bcd7123d055daa5 v7-4-622
3cca9b0cc1a0d31ac6c6a0b69544dee96ff280b4 v7-4-623
f8f2a61e538d4094e29db47954516d572b2dcca4 v7-4-624
4b1e3b3aa78abcdab840189d766f54ebdb2712fe v7-4-625
68e0e6bb8250f9b595b517e7061e83796a4b3ec0 v7-4-626
c77ef1bf9623d0c7ebd7e011e6ce7a3a12b0bf41 v7-4-627
6eecaf5a18ca95f0ff06dc2ac88015e6bb6f70ac v7-4-628
f28c171348fbfe055c86a354b4d235e2786215d9 v7-4-629
12 changes: 8 additions & 4 deletions runtime/doc/term.txt
Original file line number Diff line number Diff line change
Expand Up @@ -224,10 +224,11 @@ The options are listed below. The associated termcap code is always equal to
the last two characters of the option name. Only one termcap code is
required: Cursor motion, 't_cm'.

The options 't_da', 't_db', 't_ms', 't_xs' represent flags in the termcap.
When the termcap flag is present, the option will be set to "y". But any
non-empty string means that the flag is set. An empty string means that the
flag is not set. 't_CS' works like this too, but it isn't a termcap flag.
The options 't_da', 't_db', 't_ms', 't_xs', 't_xn' represent flags in the
termcap. When the termcap flag is present, the option will be set to "y".
But any non-empty string means that the flag is set. An empty string means
that the flag is not set. 't_CS' works like this too, but it isn't a termcap
flag.

OUTPUT CODES
option meaning ~
Expand Down Expand Up @@ -281,6 +282,9 @@ OUTPUT CODES
t_vs cursor very visible *t_vs* *'t_vs'*
*t_xs* *'t_xs'*
t_xs if non-empty, standout not erased by overwriting (hpterm)
*t_xn* *'t_xn'*
t_xn if non-empty, character writing at the last cell of screen
didn't causes scrolling
t_ZH italics mode *t_ZH* *'t_ZH'*
t_ZR italics end *t_ZR* *'t_ZR'*

Expand Down
16 changes: 16 additions & 0 deletions src/if_cscope.c
Original file line number Diff line number Diff line change
Expand Up @@ -1507,9 +1507,16 @@ cs_insert_filelist(fname, ppath, flags, sb)
}
else
{
csinfo_T *t_csinfo = csinfo;

/* Reallocate space for more connections. */
csinfo_size *= 2;
csinfo = vim_realloc(csinfo, sizeof(csinfo_T)*csinfo_size);
if (csinfo == NULL)
{
vim_free(t_csinfo);
csinfo_size = 0;
}
}
if (csinfo == NULL)
return -1;
Expand Down Expand Up @@ -2059,6 +2066,7 @@ cs_print_tags_priv(matches, cntxts, num_matches)
int num_matches;
{
char *buf = NULL;
char *t_buf;
int bufsize = 0; /* Track available bufsize */
int newsize = 0;
char *ptag;
Expand Down Expand Up @@ -2120,9 +2128,13 @@ cs_print_tags_priv(matches, cntxts, num_matches)
newsize = (int)(strlen(csfmt_str) + 16 + strlen(lno));
if (bufsize < newsize)
{
t_buf = buf;
buf = (char *)vim_realloc(buf, newsize);
if (buf == NULL)
{
bufsize = 0;
vim_free(t_buf);
}
else
bufsize = newsize;
}
Expand All @@ -2143,9 +2155,13 @@ cs_print_tags_priv(matches, cntxts, num_matches)

if (bufsize < newsize)
{
t_buf = buf;
buf = (char *)vim_realloc(buf, newsize);
if (buf == NULL)
{
bufsize = 0;
vim_free(t_buf);
}
else
bufsize = newsize;
}
Expand Down
7 changes: 5 additions & 2 deletions src/if_py_both.h
Original file line number Diff line number Diff line change
Expand Up @@ -747,12 +747,14 @@ VimToPython(typval_T *our_tv, int depth, PyObject *lookup_dict)
else if (our_tv->v_type == VAR_DICT)
{

hashtab_T *ht = &our_tv->vval.v_dict->dv_hashtab;
long_u todo = ht->ht_used;
hashtab_T *ht;
long_u todo;
hashitem_T *hi;
dictitem_T *di;

if (our_tv->vval.v_dict == NULL)
return NULL;
ht = &our_tv->vval.v_dict->dv_hashtab;

if (!(ret = PyDict_New()))
return NULL;
Expand All @@ -763,6 +765,7 @@ VimToPython(typval_T *our_tv, int depth, PyObject *lookup_dict)
return NULL;
}

todo = ht->ht_used;
for (hi = ht->ht_array; todo > 0; ++hi)
{
if (!HASHITEM_EMPTY(hi))
Expand Down
2 changes: 1 addition & 1 deletion src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1108,7 +1108,7 @@ main_loop(cmdwin, noexmode)
int noexmode; /* TRUE when return on entering Ex mode */
{
oparg_T oa; /* operator arguments */
int previous_got_int = FALSE; /* "got_int" was TRUE */
volatile int previous_got_int = FALSE; /* "got_int" was TRUE */
#ifdef FEAT_CONCEAL
linenr_T conceal_old_cursor_line = 0;
linenr_T conceal_new_cursor_line = 0;
Expand Down
3 changes: 3 additions & 0 deletions src/memline.c
Original file line number Diff line number Diff line change
Expand Up @@ -5057,13 +5057,16 @@ ml_updatechunk(buf, line, len, updtype)
/* May resize here so we don't have to do it in both cases below */
if (buf->b_ml.ml_usedchunks + 1 >= buf->b_ml.ml_numchunks)
{
chunksize_T *t_chunksize = buf->b_ml.ml_chunksize;

buf->b_ml.ml_numchunks = buf->b_ml.ml_numchunks * 3 / 2;
buf->b_ml.ml_chunksize = (chunksize_T *)
vim_realloc(buf->b_ml.ml_chunksize,
sizeof(chunksize_T) * buf->b_ml.ml_numchunks);
if (buf->b_ml.ml_chunksize == NULL)
{
/* Hmmmm, Give up on offset for this buffer */
vim_free(t_chunksize);
buf->b_ml.ml_usedchunks = -1;
return;
}
Expand Down
4 changes: 4 additions & 0 deletions src/misc1.c
Original file line number Diff line number Diff line change
Expand Up @@ -3431,10 +3431,14 @@ get_keystroke()
buf = alloc(buflen);
else if (maxlen < 10)
{
char_u *t_buf = buf;

/* Need some more space. This might happen when receiving a long
* escape sequence. */
buflen += 100;
buf = vim_realloc(buf, buflen);
if (buf == NULL)
vim_free(t_buf);
maxlen = (buflen - 6 - len) / 3;
}
if (buf == NULL)
Expand Down
22 changes: 22 additions & 0 deletions src/netbeans.c
Original file line number Diff line number Diff line change
Expand Up @@ -1109,10 +1109,18 @@ nb_get_buf(int bufno)
{
if (bufno >= buf_list_size) /* grow list */
{
nbbuf_T *t_buf_list = buf_list;

incr = bufno - buf_list_size + 90;
buf_list_size += incr;
buf_list = (nbbuf_T *)vim_realloc(
buf_list, buf_list_size * sizeof(nbbuf_T));
if (buf_list == NULL)
{
vim_free(t_buf_list);
buf_list_size = 0;
return NULL;
}
vim_memset(buf_list + buf_list_size - incr, 0,
incr * sizeof(nbbuf_T));
}
Expand Down Expand Up @@ -3713,11 +3721,18 @@ addsigntype(
{
int incr;
int oldlen = globalsignmaplen;
char **t_globalsignmap = globalsignmap;

globalsignmaplen *= 2;
incr = globalsignmaplen - oldlen;
globalsignmap = (char **)vim_realloc(globalsignmap,
globalsignmaplen * sizeof(char *));
if (globalsignmap == NULL)
{
vim_free(t_globalsignmap);
globalsignmaplen = 0;
return;
}
vim_memset(globalsignmap + oldlen, 0, incr * sizeof(char *));
}
}
Expand All @@ -3743,11 +3758,18 @@ addsigntype(
{
int incr;
int oldlen = buf->signmaplen;
int *t_signmap = buf->signmap;

buf->signmaplen *= 2;
incr = buf->signmaplen - oldlen;
buf->signmap = (int *)vim_realloc(buf->signmap,
buf->signmaplen * sizeof(int));
if (buf->signmap == NULL)
{
vim_free(t_signmap);
buf->signmaplen = 0;
return;
}
vim_memset(buf->signmap + oldlen, 0, incr * sizeof(int));
}
}
Expand Down
1 change: 1 addition & 0 deletions src/option.c
Original file line number Diff line number Diff line change
Expand Up @@ -3025,6 +3025,7 @@ static struct vimoption
p_term("t_WS", T_CWS)
p_term("t_SI", T_CSI)
p_term("t_EI", T_CEI)
p_term("t_xn", T_XN)
p_term("t_xs", T_XS)
p_term("t_ZH", T_CZH)
p_term("t_ZR", T_CZR)
Expand Down
9 changes: 5 additions & 4 deletions src/regexp_nfa.c
Original file line number Diff line number Diff line change
Expand Up @@ -2034,9 +2034,10 @@ nfa_regpiece()
}

/* The engine is very inefficient (uses too many states) when the
* maximum is much larger than the minimum. Bail out if we can
* use the other engine. */
if ((nfa_re_flags & RE_AUTO) && maxval > minval + 200)
* maximum is much larger than the minimum and when the maximum is
* large. Bail out if we can use the other engine. */
if ((nfa_re_flags & RE_AUTO)
&& (maxval > minval + 200 || maxval > 500))
return FAIL;

/* Ignore previous call to nfa_regatom() */
Expand Down Expand Up @@ -4254,7 +4255,6 @@ state_in_list(l, state, subs)
* Add "state" and possibly what follows to state list ".".
* Returns "subs_arg", possibly copied into temp_subs.
*/

static regsubs_T *
addstate(l, state, subs_arg, pim, off)
nfa_list_T *l; /* runtime state list */
Expand Down Expand Up @@ -4392,6 +4392,7 @@ addstate(l, state, subs_arg, pim, off)
subs = &temp_subs;
}

/* TODO: check for vim_realloc() returning NULL. */
l->t = vim_realloc(l->t, newlen * sizeof(nfa_thread_T));
l->len = newlen;
}
Expand Down
8 changes: 5 additions & 3 deletions src/screen.c
Original file line number Diff line number Diff line change
Expand Up @@ -7981,9 +7981,11 @@ screen_char(off, row, col)
if (row >= screen_Rows || col >= screen_Columns)
return;

/* Outputting the last character on the screen may scrollup the screen.
* Don't to it! Mark the character invalid (update it when scrolled up) */
if (row == screen_Rows - 1 && col == screen_Columns - 1
/* Outputting a character in the last cell on the screen may scroll the
* screen up. Only do it when the "xn" termcap property is set, otherwise
* mark the character invalid (update it when scrolled up). */
if (*T_XN == NUL
&& row == screen_Rows - 1 && col == screen_Columns - 1
#ifdef FEAT_RIGHTLEFT
/* account for first command-line character in rightleft mode */
&& !cmdmsg_rl
Expand Down
5 changes: 3 additions & 2 deletions src/spell.c
Original file line number Diff line number Diff line change
Expand Up @@ -311,9 +311,10 @@
# include <time.h> /* for time_t */
#endif

#define MAXWLEN 250 /* Assume max. word len is this many bytes.
#define MAXWLEN 254 /* Assume max. word len is this many bytes.
Some places assume a word length fits in a
byte, thus it can't be above 255. */
byte, thus it can't be above 255.
Must be >= PFD_NOTSPECIAL. */

/* Type used for indexes in the word tree need to be at least 4 bytes. If int
* is 8 bytes we could use something smaller, but what? */
Expand Down
7 changes: 7 additions & 0 deletions src/term.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ static struct builtin_term builtin_termcaps[] =
{(int)KS_VB, IF_EB("\033|f", ESC_STR "|f")},
{(int)KS_MS, "y"},
{(int)KS_UT, "y"},
{(int)KS_XN, "y"},
{(int)KS_LE, "\b"}, /* cursor-left = BS */
{(int)KS_ND, "\014"}, /* cursor-right = CTRL-L */
# ifdef TERMINFO
Expand Down Expand Up @@ -658,6 +659,7 @@ static struct builtin_term builtin_termcaps[] =

{(int)KS_MS, "y"}, /* save to move cur in reverse mode */
{(int)KS_UT, "y"},
{(int)KS_XN, "y"},
{(int)KS_LE, "\b"},
# ifdef TERMINFO
{(int)KS_CM, "\033|%i%p1%d;%p2%dH"},/* cursor motion */
Expand Down Expand Up @@ -772,6 +774,7 @@ static struct builtin_term builtin_termcaps[] =
{(int)KS_CSF, IF_EB("\033[101;%dm", ESC_STR "[101;%dm")}, /* set screen foreground color */
{(int)KS_MS, "y"},
{(int)KS_UT, "y"},
{(int)KS_XN, "y"},
{(int)KS_LE, "\b"},
# ifdef TERMINFO
{(int)KS_CM, IF_EB("\033[%i%p1%d;%p2%dH",
Expand Down Expand Up @@ -1207,6 +1210,7 @@ static struct builtin_term builtin_termcaps[] =
{(int)KS_UCS, "[UCS]"},
{(int)KS_MS, "[MS]"},
{(int)KS_UT, "[UT]"},
{(int)KS_XN, "[XN]"},
# ifdef TERMINFO
{(int)KS_CM, "[%p1%dCM%p2%d]"},
# else
Expand Down Expand Up @@ -1645,6 +1649,9 @@ set_termname(term)
if ((T_XS == NULL || T_XS == empty_option)
&& tgetflag("xs") > 0)
T_XS = (char_u *)"y";
if ((T_XN == NULL || T_XN == empty_option)
&& tgetflag("xn") > 0)
T_XN = (char_u *)"y";
if ((T_DB == NULL || T_DB == empty_option)
&& tgetflag("db") > 0)
T_DB = (char_u *)"y";
Expand Down
2 changes: 2 additions & 0 deletions src/term.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ enum SpecialKey
KS_CSF, /* set foreground color */
KS_CSB, /* set background color */
KS_XS, /* standout not erased by overwriting (hpterm) */
KS_XN, /* newline glitch */
KS_MB, /* blink mode */
KS_CAF, /* set foreground color (ANSI) */
KS_CAB, /* set background color (ANSI) */
Expand Down Expand Up @@ -144,6 +145,7 @@ extern char_u *(term_strings[]); /* current terminal strings */
#define T_CSF (term_str(KS_CSF)) /* set foreground color */
#define T_CSB (term_str(KS_CSB)) /* set background color */
#define T_XS (term_str(KS_XS)) /* standout not erased by overwriting */
#define T_XN (term_str(KS_XN)) /* newline glitch */
#define T_MB (term_str(KS_MB)) /* blink mode */
#define T_CAF (term_str(KS_CAF)) /* set foreground color (ANSI) */
#define T_CAB (term_str(KS_CAB)) /* set background color (ANSI) */
Expand Down
14 changes: 14 additions & 0 deletions src/version.c
Original file line number Diff line number Diff line change
Expand Up @@ -756,6 +756,20 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
/**/
629,
/**/
628,
/**/
627,
/**/
626,
/**/
625,
/**/
624,
/**/
623,
/**/
622,
/**/
Expand Down
14 changes: 14 additions & 0 deletions src/vim.h
Original file line number Diff line number Diff line change
Expand Up @@ -2047,6 +2047,20 @@ typedef int VimClipboard; /* This is required for the prototypes. */
#ifdef _MSC_VER
/* Avoid useless warning "conversion from X to Y of greater size". */
#pragma warning(disable : 4312)
/* Avoid warning for old style function declarators */
#pragma warning(disable : 4131)
/* Avoid warning for conversion to type with smaller range */
#pragma warning(disable : 4244)
/* Avoid warning for conversion to larger size */
#pragma warning(disable : 4306)
/* Avoid warning for unreferenced formal parameter */
#pragma warning(disable : 4100)
/* Avoid warning for differs in indirection to slightly different base type */
#pragma warning(disable : 4057)
/* Avoid warning for constant conditional expression */
#pragma warning(disable : 4127)
/* Avoid warning for assignment within conditional */
#pragma warning(disable : 4706)
#endif

/* Note: a NULL argument for vim_realloc() is not portable, don't use it. */
Expand Down

0 comments on commit 415c058

Please sign in to comment.