mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
updated for version 7.4.577
Problem: Matching with a virtual column has a lot of overhead on very long lines. (Issue 310) Solution: Bail out early if there can't be a match. (Christian Brabandt) Also check for CTRL-C at every position.
This commit is contained in:
parent
ba3f58e296
commit
a20bcad15c
@ -6438,14 +6438,24 @@ nfa_regmatch(prog, start, submatch, m)
|
|||||||
case NFA_VCOL:
|
case NFA_VCOL:
|
||||||
case NFA_VCOL_GT:
|
case NFA_VCOL_GT:
|
||||||
case NFA_VCOL_LT:
|
case NFA_VCOL_LT:
|
||||||
result = nfa_re_num_cmp(t->state->val, t->state->c - NFA_VCOL,
|
|
||||||
(long_u)win_linetabsize(
|
|
||||||
reg_win == NULL ? curwin : reg_win,
|
|
||||||
regline, (colnr_T)(reginput - regline)) + 1);
|
|
||||||
if (result)
|
|
||||||
{
|
{
|
||||||
add_here = TRUE;
|
int op = t->state->c - NFA_VCOL;
|
||||||
add_state = t->state->out;
|
colnr_T col = (colnr_T)(reginput - regline);
|
||||||
|
|
||||||
|
/* Bail out quickly when there can't be a match, avoid the
|
||||||
|
* overhead of win_linetabsize() on long lines. */
|
||||||
|
if ((col > t->state->val && op != 1)
|
||||||
|
|| (col - 1 > t->state->val && op == 1))
|
||||||
|
break;
|
||||||
|
result = nfa_re_num_cmp(t->state->val, op,
|
||||||
|
(long_u)win_linetabsize(
|
||||||
|
reg_win == NULL ? curwin : reg_win,
|
||||||
|
regline, col) + 1);
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
add_here = TRUE;
|
||||||
|
add_state = t->state->out;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -6744,6 +6754,11 @@ nextchar:
|
|||||||
reg_nextline();
|
reg_nextline();
|
||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
/* Allow interrupting with CTRL-C. */
|
||||||
|
fast_breakcheck();
|
||||||
|
if (got_int)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_LOG
|
#ifdef ENABLE_LOG
|
||||||
|
@ -741,6 +741,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 */
|
||||||
|
/**/
|
||||||
|
577,
|
||||||
/**/
|
/**/
|
||||||
576,
|
576,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user