summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2015-01-14 18:40:28 +0100
committerBram Moolenaar <Bram@vim.org>2015-01-14 18:40:28 +0100
commita20bcad15c826a8c43a0f66a6b438bb5a14c8196 (patch)
treefcdc1dce46f8797fadfa246868b54e334ae3469d
parentba3f58e29660d4f7501cb0e46162a399c20020c6 (diff)
downloadvim-git-a20bcad15c826a8c43a0f66a6b438bb5a14c8196.tar.gz
updated for version 7.4.577v7.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.
-rw-r--r--src/regexp_nfa.c29
-rw-r--r--src/version.c2
2 files changed, 24 insertions, 7 deletions
diff --git a/src/regexp_nfa.c b/src/regexp_nfa.c
index 8e069f351..369d96f9f 100644
--- a/src/regexp_nfa.c
+++ b/src/regexp_nfa.c
@@ -6438,14 +6438,24 @@ nfa_regmatch(prog, start, submatch, m)
case NFA_VCOL:
case NFA_VCOL_GT:
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;
- add_state = t->state->out;
+ int op = t->state->c - NFA_VCOL;
+ 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;
@@ -6744,6 +6754,11 @@ nextchar:
reg_nextline();
else
break;
+
+ /* Allow interrupting with CTRL-C. */
+ fast_breakcheck();
+ if (got_int)
+ break;
}
#ifdef ENABLE_LOG
diff --git a/src/version.c b/src/version.c
index 4f310058d..1367621f4 100644
--- a/src/version.c
+++ b/src/version.c
@@ -742,6 +742,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 577,
+/**/
576,
/**/
575,