]> granicus.if.org Git - vim/commitdiff
updated for version 7.4.021 v7.4.021
authorBram Moolenaar <Bram@vim.org>
Thu, 5 Sep 2013 19:15:44 +0000 (21:15 +0200)
committerBram Moolenaar <Bram@vim.org>
Thu, 5 Sep 2013 19:15:44 +0000 (21:15 +0200)
Problem:    NFA regexp: Using \ze in one branch which doesn't match may cause
            end of another branch to be wrong. (William Fugh)
Solution:   Set end position if it wasn't set yet.

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

index fe1d0258292118e86ecb2fe3a3598124a1abe4d4..30aae8dcceecc95fe1c6c1fa62e213004418e5e8 100644 (file)
@@ -4209,10 +4209,11 @@ skip_add:
            break;
 
        case NFA_MCLOSE:
-           if (nfa_has_zend)
+           if (nfa_has_zend && (REG_MULTI
+                       ? subs->norm.list.multi[0].end.lnum >= 0
+                       : subs->norm.list.line[0].end != NULL))
            {
-               /* Do not overwrite the position set by \ze. If no \ze
-                * encountered end will be set in nfa_regtry(). */
+               /* Do not overwrite the position set by \ze. */
                subs = addstate(l, state->out, subs, pim, off);
                break;
            }
index 8f7008c1a16bb0240e7a709816606aa1355b48f0..e694995cfd11105d1b749c9c21679a722cc56ca2 100644 (file)
@@ -328,6 +328,7 @@ STARTTEST
 :call add(tl, [2, 'abc \zsmatch\ze abc', 'abc abc abc match abc abc', 'match'])
 :call add(tl, [2, '\v(a \zsif .*){2}', 'a if then a if last', 'if last', 'a if last'])
 :call add(tl, [2, '\>\zs.', 'aword. ', '.'])
+:call add(tl, [2, '\s\+\ze\[/\|\s\zs\s\+', 'is   [a t', '  '])
 :"
 :"""" Tests for \@= and \& features
 :call add(tl, [2, 'abc\@=', 'abc', 'ab'])
index fa83f91afa45b230a256a6d4fa92ce2d1af70736..3d117b99575b9fe6aa09f657cd24dd1b6567f1d1 100644 (file)
@@ -752,6 +752,9 @@ OK 2 - \v(a \zsif .*){2}
 OK 0 - \>\zs.
 OK 1 - \>\zs.
 OK 2 - \>\zs.
+OK 0 - \s\+\ze\[/\|\s\zs\s\+
+OK 1 - \s\+\ze\[/\|\s\zs\s\+
+OK 2 - \s\+\ze\[/\|\s\zs\s\+
 OK 0 - abc\@=
 OK 1 - abc\@=
 OK 2 - abc\@=
index 99c9d222df3563a6a6cc1d5383d0e197b9e3ac7f..06bcaa3e4135a14b5eb52d1c0a98b1c1be768a74 100644 (file)
@@ -738,6 +738,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    21,
 /**/
     20,
 /**/