0
0
mirror of https://github.com/vim/vim.git synced 2025-09-30 04:44:14 -04:00

updated for version 7.3.999

Problem:    New regexp engine sets curbuf temporarily.
Solution:   Use reg_buf instead, like the old engine.
This commit is contained in:
Bram Moolenaar
2013-05-21 21:20:20 +02:00
parent e6ae6225b4
commit f878bf0da2
2 changed files with 12 additions and 17 deletions

View File

@@ -3125,15 +3125,16 @@ again:
int this_class; int this_class;
/* Get class of current and previous char (if it exists). */ /* Get class of current and previous char (if it exists). */
this_class = mb_get_class(reginput); this_class = mb_get_class_buf(reginput, reg_buf);
if (this_class <= 1) if (this_class <= 1)
bow = FALSE; bow = FALSE;
else if (reg_prev_class() == this_class) else if (reg_prev_class() == this_class)
bow = FALSE; bow = FALSE;
} }
#endif #endif
else if (!vim_iswordc(c) else if (!vim_iswordc_buf(c, reg_buf)
|| (reginput > regline && vim_iswordc(reginput[-1]))) || (reginput > regline
&& vim_iswordc_buf(reginput[-1], reg_buf)))
bow = FALSE; bow = FALSE;
if (bow) if (bow)
addstate(thislist, t->state->out, &t->sub, 0, listid, addstate(thislist, t->state->out, &t->sub, 0, listid,
@@ -3153,15 +3154,15 @@ again:
int this_class, prev_class; int this_class, prev_class;
/* Get class of current and previous char (if it exists). */ /* Get class of current and previous char (if it exists). */
this_class = mb_get_class(reginput); this_class = mb_get_class_buf(reginput, reg_buf);
prev_class = reg_prev_class(); prev_class = reg_prev_class();
if (this_class == prev_class if (this_class == prev_class
|| prev_class == 0 || prev_class == 1) || prev_class == 0 || prev_class == 1)
eow = FALSE; eow = FALSE;
} }
#endif #endif
else if (!vim_iswordc(reginput[-1]) else if (!vim_iswordc_buf(reginput[-1], reg_buf)
|| (reginput[0] != NUL && vim_iswordc(c))) || (reginput[0] != NUL && vim_iswordc_buf(c, reg_buf)))
eow = FALSE; eow = FALSE;
if (eow) if (eow)
addstate(thislist, t->state->out, &t->sub, 0, listid, addstate(thislist, t->state->out, &t->sub, 0, listid,
@@ -3267,12 +3268,12 @@ again:
break; break;
case NFA_KWORD: /* \k */ case NFA_KWORD: /* \k */
result = vim_iswordp(reginput); result = vim_iswordp_buf(reginput, reg_buf);
ADD_POS_NEG_STATE(t->state); ADD_POS_NEG_STATE(t->state);
break; break;
case NFA_SKWORD: /* \K */ case NFA_SKWORD: /* \K */
result = !VIM_ISDIGIT(c) && vim_iswordp(reginput); result = !VIM_ISDIGIT(c) && vim_iswordp_buf(reginput, reg_buf);
ADD_POS_NEG_STATE(t->state); ADD_POS_NEG_STATE(t->state);
break; break;
@@ -3826,9 +3827,6 @@ nfa_regexec_multi(rmp, win, buf, lnum, col, tm)
colnr_T col; /* column to start looking for match */ colnr_T col; /* column to start looking for match */
proftime_T *tm UNUSED; /* timeout limit or NULL */ proftime_T *tm UNUSED; /* timeout limit or NULL */
{ {
long r;
buf_T *save_curbuf = curbuf;
reg_match = NULL; reg_match = NULL;
reg_mmatch = rmp; reg_mmatch = rmp;
reg_buf = buf; reg_buf = buf;
@@ -3842,12 +3840,7 @@ nfa_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. */ return nfa_regexec_both(NULL, col);
curbuf = buf;
r = nfa_regexec_both(NULL, col);
curbuf = save_curbuf;
return r;
} }
#ifdef DEBUG #ifdef DEBUG

View File

@@ -728,6 +728,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 */
/**/
999,
/**/ /**/
998, 998,
/**/ /**/