]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
updated for version 7.3.1026 v7.3.1026
authorBram Moolenaar <Bram@vim.org>
Sun, 26 May 2013 16:40:14 +0000 (18:40 +0200)
committerBram Moolenaar <Bram@vim.org>
Sun, 26 May 2013 16:40:14 +0000 (18:40 +0200)
Problem:    New regexp: pattern that includs a new-line matches too early.
            (john McGowan)
Solution:   Do not start searching in the second line.

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

index df5be1100ff0cd92eaa155ee672ff896cd62612c..9029460f871544e1ab0b83f4ca4f3870866d7489 100644 (file)
@@ -3585,12 +3585,15 @@ nfa_regmatch(start, submatch, m)
 
        } /* for (thislist = thislist; thislist->state; thislist++) */
 
-       /* The first found match is the leftmost one, but there may be a
-        * longer one. Keep running the NFA, but don't start from the
-        * beginning. Also, do not add the start state in recursive calls of
-        * nfa_regmatch(), because recursive calls should only start in the
-        * first position. */
-       if (match == FALSE && start->c == NFA_MOPEN + 0)
+       /* Look for the start of a match in the current position by adding the
+        * start state to the list of states.
+        * The first found match is the leftmost one, thus the order of states
+        * matters!
+        * Do not add the start state in recursive calls of nfa_regmatch(),
+        * because recursive calls should only start in the first position.
+        * Also don't start a match past the first line. */
+       if (match == FALSE && start->c == NFA_MOPEN + 0
+                                                && reglnum == 0 && clen != 0)
        {
 #ifdef ENABLE_LOG
            fprintf(log_fd, "(---) STARTSTATE\n");
index 8d0f53597ebdf77ac5d3fb08ef3fdf250090e2d4..d30d76d931fad162c512eb787f06a97a250fc8fd 100644 (file)
@@ -372,6 +372,12 @@ y$Go\ep:"
 :.+1,.+2yank
 Go\ep:"
 :"
+:" Check a pattern with a line break matches in the right position.
+/^Multiline
+/\S.*\nx
+:.yank
+y$Go\ep:"
+:"
 :"
 :/\%#=1^Results/,$wq! test.out
 ENDTEST
@@ -383,4 +389,11 @@ Substitute here:
 <T="">Ta 5</Title>
 <T="">Ac 7</Title>
 
+Multiline:
+abc
+def
+ghi
+xjk
+lmn
+
 Results of test64:
index 40b02cdfac430803ba3eb84c28dadd5e2f145923..c6733ca3d95102250f89b34ea78c9d728eeda348 100644 (file)
@@ -705,3 +705,4 @@ OK 2 - \<goo\|go
 
 <T="5">Ta 5</Title>
 <T="7">Ac 7</Title>
+ghi
index a44b1e298eae2495fc9f9c9072eb7c66e4c11be8..51d86af5b123a2a6d351b8996f7468a10edea927 100644 (file)
@@ -728,6 +728,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1026,
 /**/
     1025,
 /**/