1
0
forked from aniani/vim

updated for version 7.3.776

Problem:    ml_get error when searching, caused by curwin not matching curbuf.
Solution:   Avoid changing curbuf. (Lech Lorens)
This commit is contained in:
Bram Moolenaar
2013-01-23 15:53:15 +01:00
parent 4da70dbc4d
commit 9d182dd0a6
8 changed files with 48 additions and 30 deletions

View File

@@ -904,6 +904,14 @@ vim_isIDc(c)
int int
vim_iswordc(c) vim_iswordc(c)
int c; int c;
{
return vim_iswordc_buf(c, curbuf);
}
int
vim_iswordc_buf(c, buf)
int c;
buf_T *buf;
{ {
#ifdef FEAT_MBYTE #ifdef FEAT_MBYTE
if (c >= 0x100) if (c >= 0x100)
@@ -914,7 +922,7 @@ vim_iswordc(c)
return utf_class(c) >= 2; return utf_class(c) >= 2;
} }
#endif #endif
return (c > 0 && c < 0x100 && GET_CHARTAB(curbuf, c) != 0); return (c > 0 && c < 0x100 && GET_CHARTAB(buf, c) != 0);
} }
/* /*
@@ -933,7 +941,7 @@ vim_iswordp(p)
#if defined(FEAT_SYN_HL) || defined(PROTO) #if defined(FEAT_SYN_HL) || defined(PROTO)
int int
vim_iswordc_buf(p, buf) vim_iswordp_buf(p, buf)
char_u *p; char_u *p;
buf_T *buf; buf_T *buf;
{ {

View File

@@ -18884,7 +18884,7 @@ var2fpos(varp, dollar_lnum, fnum)
#endif #endif
if (name[0] == '\'') /* mark */ if (name[0] == '\'') /* mark */
{ {
pp = getmark_fnum(name[1], FALSE, fnum); pp = getmark_buf_fnum(curbuf, name[1], FALSE, fnum);
if (pp == NULL || pp == (pos_T *)-1 || pp->lnum <= 0) if (pp == NULL || pp == (pos_T *)-1 || pp->lnum <= 0)
return NULL; return NULL;
return pp; return pp;

View File

@@ -304,7 +304,7 @@ movechangelist(count)
#endif #endif
/* /*
* Find mark "c". * Find mark "c" in buffer pointed to by "buf".
* If "changefile" is TRUE it's allowed to edit another file for '0, 'A, etc. * If "changefile" is TRUE it's allowed to edit another file for '0, 'A, etc.
* If "fnum" is not NULL store the fnum there for '0, 'A etc., don't edit * If "fnum" is not NULL store the fnum there for '0, 'A etc., don't edit
* another file. * another file.
@@ -314,16 +314,26 @@ movechangelist(count)
* - NULL if there is no mark called 'c'. * - NULL if there is no mark called 'c'.
* - -1 if mark is in other file and jumped there (only if changefile is TRUE) * - -1 if mark is in other file and jumped there (only if changefile is TRUE)
*/ */
pos_T *
getmark_buf(buf, c, changefile)
buf_T *buf;
int c;
int changefile;
{
return getmark_buf_fnum(buf, c, changefile, NULL);
}
pos_T * pos_T *
getmark(c, changefile) getmark(c, changefile)
int c; int c;
int changefile; int changefile;
{ {
return getmark_fnum(c, changefile, NULL); return getmark_buf_fnum(curbuf, c, changefile, NULL);
} }
pos_T * pos_T *
getmark_fnum(c, changefile, fnum) getmark_buf_fnum(buf, c, changefile, fnum)
buf_T *buf;
int c; int c;
int changefile; int changefile;
int *fnum; int *fnum;
@@ -351,15 +361,15 @@ getmark_fnum(c, changefile, fnum)
posp = &pos_copy; /* w_pcmark may be changed soon */ posp = &pos_copy; /* w_pcmark may be changed soon */
} }
else if (c == '"') /* to pos when leaving buffer */ else if (c == '"') /* to pos when leaving buffer */
posp = &(curbuf->b_last_cursor); posp = &(buf->b_last_cursor);
else if (c == '^') /* to where Insert mode stopped */ else if (c == '^') /* to where Insert mode stopped */
posp = &(curbuf->b_last_insert); posp = &(buf->b_last_insert);
else if (c == '.') /* to where last change was made */ else if (c == '.') /* to where last change was made */
posp = &(curbuf->b_last_change); posp = &(buf->b_last_change);
else if (c == '[') /* to start of previous operator */ else if (c == '[') /* to start of previous operator */
posp = &(curbuf->b_op_start); posp = &(buf->b_op_start);
else if (c == ']') /* to end of previous operator */ else if (c == ']') /* to end of previous operator */
posp = &(curbuf->b_op_end); posp = &(buf->b_op_end);
else if (c == '{' || c == '}') /* to previous/next paragraph */ else if (c == '{' || c == '}') /* to previous/next paragraph */
{ {
pos_T pos; pos_T pos;
@@ -395,8 +405,8 @@ getmark_fnum(c, changefile, fnum)
#ifdef FEAT_VISUAL #ifdef FEAT_VISUAL
else if (c == '<' || c == '>') /* start/end of visual area */ else if (c == '<' || c == '>') /* start/end of visual area */
{ {
startp = &curbuf->b_visual.vi_start; startp = &buf->b_visual.vi_start;
endp = &curbuf->b_visual.vi_end; endp = &buf->b_visual.vi_end;
if ((c == '<') == lt(*startp, *endp)) if ((c == '<') == lt(*startp, *endp))
posp = startp; posp = startp;
else else
@@ -404,7 +414,7 @@ getmark_fnum(c, changefile, fnum)
/* /*
* For Visual line mode, set mark at begin or end of line * For Visual line mode, set mark at begin or end of line
*/ */
if (curbuf->b_visual.vi_mode == 'V') if (buf->b_visual.vi_mode == 'V')
{ {
pos_copy = *posp; pos_copy = *posp;
posp = &pos_copy; posp = &pos_copy;
@@ -420,7 +430,7 @@ getmark_fnum(c, changefile, fnum)
#endif #endif
else if (ASCII_ISLOWER(c)) /* normal named mark */ else if (ASCII_ISLOWER(c)) /* normal named mark */
{ {
posp = &(curbuf->b_namedm[c - 'a']); posp = &(buf->b_namedm[c - 'a']);
} }
else if (ASCII_ISUPPER(c) || VIM_ISDIGIT(c)) /* named file mark */ else if (ASCII_ISUPPER(c) || VIM_ISDIGIT(c)) /* named file mark */
{ {
@@ -435,7 +445,7 @@ getmark_fnum(c, changefile, fnum)
if (fnum != NULL) if (fnum != NULL)
*fnum = namedfm[c].fmark.fnum; *fnum = namedfm[c].fmark.fnum;
else if (namedfm[c].fmark.fnum != curbuf->b_fnum) else if (namedfm[c].fmark.fnum != buf->b_fnum)
{ {
/* mark is in another file */ /* mark is in another file */
posp = &pos_copy; posp = &pos_copy;

View File

@@ -19,8 +19,9 @@ int linetabsize_col __ARGS((int startcol, char_u *s));
int win_linetabsize __ARGS((win_T *wp, char_u *p, colnr_T len)); int win_linetabsize __ARGS((win_T *wp, char_u *p, colnr_T len));
int vim_isIDc __ARGS((int c)); int vim_isIDc __ARGS((int c));
int vim_iswordc __ARGS((int c)); int vim_iswordc __ARGS((int c));
int vim_iswordc_buf __ARGS((int c, buf_T *buf));
int vim_iswordp __ARGS((char_u *p)); int vim_iswordp __ARGS((char_u *p));
int vim_iswordc_buf __ARGS((char_u *p, buf_T *buf)); int vim_iswordp_buf __ARGS((char_u *p, buf_T *buf));
int vim_isfilec __ARGS((int c)); int vim_isfilec __ARGS((int c));
int vim_isfilec_or_wc __ARGS((int c)); int vim_isfilec_or_wc __ARGS((int c));
int vim_isprintc __ARGS((int c)); int vim_isprintc __ARGS((int c));

View File

@@ -5,8 +5,9 @@ void setpcmark __ARGS((void));
void checkpcmark __ARGS((void)); void checkpcmark __ARGS((void));
pos_T *movemark __ARGS((int count)); pos_T *movemark __ARGS((int count));
pos_T *movechangelist __ARGS((int count)); pos_T *movechangelist __ARGS((int count));
pos_T *getmark_buf __ARGS((buf_T *buf, int c, int changefile));
pos_T *getmark __ARGS((int c, int changefile)); pos_T *getmark __ARGS((int c, int changefile));
pos_T *getmark_fnum __ARGS((int c, int changefile, int *fnum)); pos_T *getmark_buf_fnum __ARGS((buf_T *buf, int c, int changefile, int *fnum));
pos_T *getnextmark __ARGS((pos_T *startpos, int dir, int begin_line)); pos_T *getnextmark __ARGS((pos_T *startpos, int dir, int begin_line));
void fmarks_check_names __ARGS((buf_T *buf)); void fmarks_check_names __ARGS((buf_T *buf));
int check_mark __ARGS((pos_T *pos)); int check_mark __ARGS((pos_T *pos));

View File

@@ -3623,7 +3623,6 @@ vim_regexec_multi(rmp, win, buf, lnum, col, tm)
proftime_T *tm; /* timeout limit or NULL */ proftime_T *tm; /* timeout limit or NULL */
{ {
long r; long r;
buf_T *save_curbuf = curbuf;
reg_match = NULL; reg_match = NULL;
reg_mmatch = rmp; reg_mmatch = rmp;
@@ -3638,10 +3637,7 @@ vim_regexec_multi(rmp, win, buf, lnum, col, tm)
#endif #endif
ireg_maxcol = rmp->rmm_maxcol; ireg_maxcol = rmp->rmm_maxcol;
/* Need to switch to buffer "buf" to make vim_iswordc() work. */
curbuf = buf;
r = vim_regexec_both(NULL, col, tm); r = vim_regexec_both(NULL, col, tm);
curbuf = save_curbuf;
return r; return r;
} }
@@ -4185,7 +4181,7 @@ regmatch(scan)
int cmp = OPERAND(scan)[1]; int cmp = OPERAND(scan)[1];
pos_T *pos; pos_T *pos;
pos = getmark(mark, FALSE); pos = getmark_buf(reg_buf, mark, FALSE);
if (pos == NULL /* mark doesn't exist */ if (pos == NULL /* mark doesn't exist */
|| pos->lnum <= 0 /* mark isn't set (in curbuf) */ || pos->lnum <= 0 /* mark isn't set (in curbuf) */
|| (pos->lnum == reglnum + reg_firstlnum || (pos->lnum == reglnum + reg_firstlnum
@@ -4315,8 +4311,8 @@ regmatch(scan)
#endif #endif
else else
{ {
if (!vim_iswordc(c) if (!vim_iswordc_buf(c, reg_buf)
|| (reginput > regline && vim_iswordc(reginput[-1]))) || (reginput > regline && vim_iswordc_buf(reginput[-1], reg_buf)))
status = RA_NOMATCH; status = RA_NOMATCH;
} }
break; break;
@@ -4339,8 +4335,8 @@ regmatch(scan)
#endif #endif
else else
{ {
if (!vim_iswordc(reginput[-1]) if (!vim_iswordc_buf(reginput[-1], reg_buf)
|| (reginput[0] != NUL && vim_iswordc(c))) || (reginput[0] != NUL && vim_iswordc_buf(c, reg_buf)))
status = RA_NOMATCH; status = RA_NOMATCH;
} }
break; /* Matched with EOW */ break; /* Matched with EOW */

View File

@@ -1954,9 +1954,9 @@ syn_current_attr(syncing, displaying, can_spell, keep_state)
if (do_keywords) if (do_keywords)
{ {
line = syn_getcurline(); line = syn_getcurline();
if (vim_iswordc_buf(line + current_col, syn_buf) if (vim_iswordp_buf(line + current_col, syn_buf)
&& (current_col == 0 && (current_col == 0
|| !vim_iswordc_buf(line + current_col - 1 || !vim_iswordp_buf(line + current_col - 1
#ifdef FEAT_MBYTE #ifdef FEAT_MBYTE
- (has_mbyte - (has_mbyte
? (*mb_head_off)(line, line + current_col - 1) ? (*mb_head_off)(line, line + current_col - 1)
@@ -3280,7 +3280,7 @@ check_keyword_id(line, startcol, endcolp, flagsp, next_listp, cur_si, ccharp)
#endif #endif
++kwlen; ++kwlen;
} }
while (vim_iswordc_buf(kwp + kwlen, syn_buf)); while (vim_iswordp_buf(kwp + kwlen, syn_buf));
if (kwlen > MAXKEYWLEN) if (kwlen > MAXKEYWLEN)
return 0; return 0;

View File

@@ -725,6 +725,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
776,
/**/ /**/
775, 775,
/**/ /**/