summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2013-05-26 18:40:14 +0200
committerBram Moolenaar <Bram@vim.org>2013-05-26 18:40:14 +0200
commite23febdb857c0b0e297128d80bdde12240056653 (patch)
treeb12bb6d83bbab2e659192da9f45a37926a7f55f7
parent61db8b5108f2f08264e72bd1c55f5b32f5a64c34 (diff)
downloadvim-git-e23febdb857c0b0e297128d80bdde12240056653.tar.gz
updated for version 7.3.1026v7.3.1026
Problem: New regexp: pattern that includs a new-line matches too early. (john McGowan) Solution: Do not start searching in the second line.
-rw-r--r--src/regexp_nfa.c15
-rw-r--r--src/testdir/test64.in13
-rw-r--r--src/testdir/test64.ok1
-rw-r--r--src/version.c2
4 files changed, 25 insertions, 6 deletions
diff --git a/src/regexp_nfa.c b/src/regexp_nfa.c
index df5be1100..9029460f8 100644
--- a/src/regexp_nfa.c
+++ b/src/regexp_nfa.c
@@ -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");
diff --git a/src/testdir/test64.in b/src/testdir/test64.in
index 8d0f53597..d30d76d93 100644
--- a/src/testdir/test64.in
+++ b/src/testdir/test64.in
@@ -372,6 +372,12 @@ y$Gop:"
:.+1,.+2yank
Gop:"
:"
+:" Check a pattern with a line break matches in the right position.
+/^Multiline
+/\S.*\nx
+:.yank
+y$Gop:"
+:"
:"
:/\%#=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:
diff --git a/src/testdir/test64.ok b/src/testdir/test64.ok
index 40b02cdfa..c6733ca3d 100644
--- a/src/testdir/test64.ok
+++ b/src/testdir/test64.ok
@@ -705,3 +705,4 @@ OK 2 - \<goo\|go
<T="5">Ta 5</Title>
<T="7">Ac 7</Title>
+ghi
diff --git a/src/version.c b/src/version.c
index a44b1e298..51d86af5b 100644
--- a/src/version.c
+++ b/src/version.c
@@ -729,6 +729,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1026,
+/**/
1025,
/**/
1024,