From 98d226ebea87c9eeadcf85a5f624eccf64809c53 Mon Sep 17 00:00:00 2001 From: edyfox Date: Mon, 6 Aug 2007 02:11:11 +0000 Subject: [PATCH] Merged from the latest developing branch. git-svn-id: https://vim.svn.sourceforge.net/svnroot/vim/trunk@407 2a77ed30-b011-0410-a7ad-c7884a0aa172 --- src/message.c | 2 +- src/screen.c | 24 ++++++++++++------------ src/spell.c | 15 +++++++++++++-- src/version.c | 8 ++++++++ src/window.c | 8 +++++--- 5 files changed, 39 insertions(+), 18 deletions(-) diff --git a/src/message.c b/src/message.c index 9c574916..609922a2 100644 --- a/src/message.c +++ b/src/message.c @@ -1842,7 +1842,7 @@ msg_puts_display(str, maxlen, attr, recurse) int wrap; did_wait_return = FALSE; - while (*s != NUL && (maxlen < 0 || (int)(s - str) < maxlen)) + while ((maxlen < 0 || (int)(s - str) < maxlen) && *s != NUL) { /* * We are at the end of the screen line when: diff --git a/src/screen.c b/src/screen.c index addc13b9..009968be 100644 --- a/src/screen.c +++ b/src/screen.c @@ -2555,7 +2555,7 @@ win_line(wp, lnum, startrow, endrow, nochange) char_u extra[18]; /* "%ld" and 'fdc' must fit in here */ int n_extra = 0; /* number of extra chars */ - char_u *p_extra = NULL; /* string of extra chars */ + char_u *p_extra = NULL; /* string of extra chars, plus NUL */ int c_extra = NUL; /* extra chars, all the same */ int extra_attr = 0; /* attributes when n_extra != 0 */ static char_u *at_end_str = (char_u *)""; /* used for p_extra when @@ -3189,10 +3189,8 @@ win_line(wp, lnum, startrow, endrow, nochange) if (cmdwin_type != 0 && wp == curwin) { /* Draw the cmdline character. */ - *extra = cmdwin_type; n_extra = 1; - p_extra = extra; - c_extra = NUL; + c_extra = cmdwin_type; char_attr = hl_attr(HLF_AT); } } @@ -3208,6 +3206,7 @@ win_line(wp, lnum, startrow, endrow, nochange) fill_foldcolumn(extra, wp, FALSE, lnum); n_extra = wp->w_p_fdc; p_extra = extra; + p_extra[n_extra] = NUL; c_extra = NUL; char_attr = hl_attr(HLF_FC); } @@ -3550,9 +3549,11 @@ win_line(wp, lnum, startrow, endrow, nochange) * Get the next character to put on the screen. */ /* - * The 'extra' array contains the extra stuff that is inserted to - * represent special characters (non-printable stuff). When all - * characters are the same, c_extra is used. + * The "p_extra" points to the extra stuff that is inserted to + * represent special characters (non-printable stuff) and other + * things. When all characters are the same, c_extra is used. + * "p_extra" must end in a NUL to avoid mb_ptr2len() reads past + * "p_extra[n_extra]". * For the '$' of the 'list' option, n_extra == 1, p_extra == "". */ if (n_extra > 0) @@ -3808,10 +3809,8 @@ win_line(wp, lnum, startrow, endrow, nochange) * a '<' in the first column. */ if (n_skip > 0 && mb_l > 1) { - extra[0] = '<'; - p_extra = extra; n_extra = 1; - c_extra = NUL; + c_extra = '<'; c = ' '; if (area_attr == 0 && search_attr == 0) { @@ -6204,8 +6203,9 @@ screen_puts_len(text, len, row, col, attr) return; off = LineOffset[row] + col; - while (*ptr != NUL && col < screen_Columns - && (len < 0 || (int)(ptr - text) < len)) + while (col < screen_Columns + && (len < 0 || (int)(ptr - text) < len) + && *ptr != NUL) { c = *ptr; #ifdef FEAT_MBYTE diff --git a/src/spell.c b/src/spell.c index a4c68117..ce887f74 100644 --- a/src/spell.c +++ b/src/spell.c @@ -12182,7 +12182,9 @@ suggest_trie_walk(su, lp, fword, soundfold) { n = mb_cptr2len(p); c = mb_ptr2char(p); - if (!soundfold && !spell_iswordp(p + n, curbuf)) + if (p[n] == NUL) + c2 = NUL; + else if (!soundfold && !spell_iswordp(p + n, curbuf)) c2 = c; /* don't swap non-word char */ else c2 = mb_ptr2char(p + n); @@ -12190,12 +12192,21 @@ suggest_trie_walk(su, lp, fword, soundfold) else #endif { - if (!soundfold && !spell_iswordp(p + 1, curbuf)) + if (p[1] == NUL) + c2 = NUL; + else if (!soundfold && !spell_iswordp(p + 1, curbuf)) c2 = c; /* don't swap non-word char */ else c2 = p[1]; } + /* When the second character is NUL we can't swap. */ + if (c2 == NUL) + { + sp->ts_state = STATE_REP_INI; + break; + } + /* When characters are identical, swap won't do anything. * Also get here if the second char is not a word character. */ if (c == c2) diff --git a/src/version.c b/src/version.c index 95f2a4fa..d486d60b 100644 --- a/src/version.c +++ b/src/version.c @@ -667,6 +667,14 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 54, +/**/ + 53, +/**/ + 52, +/**/ + 51, +/**/ 50, /**/ 49, diff --git a/src/window.c b/src/window.c index 85a0b02c..b4ed10a5 100644 --- a/src/window.c +++ b/src/window.c @@ -6200,7 +6200,7 @@ match_add(wp, grp, pat, prio, id) matchitem_T *prev; matchitem_T *m; int hlg_id; - regmmatch_T match; + regprog_T *regprog; if (*grp == NUL || *pat == NUL) return -1; @@ -6227,7 +6227,7 @@ match_add(wp, grp, pat, prio, id) EMSG2(_(e_nogroup), grp); return -1; } - if ((match.regprog = vim_regcomp(pat, RE_MAGIC)) == NULL) + if ((regprog = vim_regcomp(pat, RE_MAGIC)) == NULL) { EMSG2(_(e_invarg2), pat); return -1; @@ -6250,7 +6250,9 @@ match_add(wp, grp, pat, prio, id) m->priority = prio; m->pattern = vim_strsave(pat); m->hlg_id = hlg_id; - m->match.regprog = match.regprog; + m->match.regprog = regprog; + m->match.rmm_ic = FALSE; + m->match.rmm_maxcol = 0; /* Insert new match. The match list is in ascending order with regard to * the match priorities. */ -- 2.11.4.GIT