forked from aniani/vim
updated for version 7.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.
This commit is contained in:
@@ -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");
|
||||
|
@@ -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:
|
||||
|
@@ -705,3 +705,4 @@ OK 2 - \<goo\|go
|
||||
|
||||
<T="5">Ta 5</Title>
|
||||
<T="7">Ac 7</Title>
|
||||
ghi
|
||||
|
@@ -728,6 +728,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
1026,
|
||||
/**/
|
||||
1025,
|
||||
/**/
|
||||
|
Reference in New Issue
Block a user