]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
updated for version 7.4.582 v7.4.582
authorBram Moolenaar <Bram@vim.org>
Sun, 18 Jan 2015 15:46:32 +0000 (16:46 +0100)
committerBram Moolenaar <Bram@vim.org>
Sun, 18 Jan 2015 15:46:32 +0000 (16:46 +0100)
Problem:    Can't match "%>80v" properly. (Axel Bender)
Solution:   Correctly handle ">". (Christian Brabandt)

src/regexp_nfa.c
src/testdir/test64.in
src/testdir/test64.ok
src/version.c

index 369d96f9f0c2034037d136e4a2be8ffe3c4d4095..03d7868fa9daf1686541311dd66f0ea6782b83a7 100644 (file)
@@ -6441,16 +6441,26 @@ nfa_regmatch(prog, start, submatch, m)
                {
                    int     op = t->state->c - NFA_VCOL;
                    colnr_T col = (colnr_T)(reginput - regline);
+                   win_T   *wp = reg_win == NULL ? curwin : reg_win;
 
                    /* 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))
+                   if (op != 1 && col > t->state->val)
                        break;
-                   result = nfa_re_num_cmp(t->state->val, op,
-                       (long_u)win_linetabsize(
-                               reg_win == NULL ? curwin : reg_win,
-                                                          regline, col) + 1);
+                   result = FALSE;
+                   if (op == 1 && col - 1 > t->state->val && col > 100)
+                   {
+                       int ts = wp->w_buffer->b_p_ts;
+
+                       /* Guess that a character won't use more columns than
+                        * 'tabstop', with a minimum of 4. */
+                       if (ts < 4)
+                           ts = 4;
+                       result = col > t->state->val * ts;
+                   }
+                   if (!result)
+                       result = nfa_re_num_cmp(t->state->val, op,
+                               (long_u)win_linetabsize(wp, regline, col) + 1);
                    if (result)
                    {
                        add_here = TRUE;
index f2452fc0f3ad26e2f1a4a09a4168ee2beddc371e..fd19d3af3257bb53a4f2e21b095454b248a892b6 100644 (file)
@@ -7,6 +7,7 @@ actually tried.
 STARTTEST
 :so small.vim
 :" tl is a List of Lists with:
+:"    regexp engine
 :"    regexp pattern
 :"    text to test the pattern on
 :"    expected match (optional)
@@ -451,6 +452,9 @@ STARTTEST
 :"""" Skip adding state twice
 :call add(tl, [2, '^\%(\%(^\s*#\s*if\>\|#\s*if\)\)\(\%>1c.*$\)\@=', "#if FOO", "#if", ' FOO'])
 :"
+:""" Test \%V atom
+:call add(tl, [2, '\%>70vGesamt', 'Jean-Michel Charlier & Victor Hubinon\Gesamtausgabe [Salleck]    Buck Danny {Jean-Michel Charlier & Victor Hubinon}\Gesamtausgabe', 'Gesamt'])
+:"
 :"""" Run the tests
 :"
 :for t in tl
index ffc0b5341f3bdf942abe452ea43e6c77d29bcef8..92f06ea9f323a2922370b915d0d59836411b712d 100644 (file)
@@ -1030,6 +1030,9 @@ OK 2 - [0-9a-zA-Z]\{8}-\([0-9a-zA-Z]\{4}-\)\{3}[0-9a-zA-Z]\{12}
 OK 0 - ^\%(\%(^\s*#\s*if\>\|#\s*if\)\)\(\%>1c.*$\)\@=
 OK 1 - ^\%(\%(^\s*#\s*if\>\|#\s*if\)\)\(\%>1c.*$\)\@=
 OK 2 - ^\%(\%(^\s*#\s*if\>\|#\s*if\)\)\(\%>1c.*$\)\@=
+OK 0 - \%>70vGesamt
+OK 1 - \%>70vGesamt
+OK 2 - \%>70vGesamt
 multi-line tests
 OK 0 - ^.\(.\).\_..\1.
 OK 1 - ^.\(.\).\_..\1.
index 4e8559ccc1187976b2227ea6e2c85656cc624550..57089fa48188454c9b84e84a1bf13755f0da82bc 100644 (file)
@@ -741,6 +741,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    582,
 /**/
     581,
 /**/