Patch 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.
Files: src/regexp_nfa.c, src/testdir/test64.in, src/testdir/test64.ok
*** ../vim-7.3.1025/src/regexp_nfa.c 2013-05-26 17:45:41.000000000 +0200
--- src/regexp_nfa.c 2013-05-26 18:38:01.000000000 +0200
***************
*** 3585,3596 ****
} /* 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)
{
#ifdef ENABLE_LOG
fprintf(log_fd, "(---) STARTSTATE\n");
--- 3585,3599 ----
} /* for (thislist = thislist; thislist->state; thislist++) */
! /* 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");
*** ../vim-7.3.1025/src/testdir/test64.in 2013-05-26 17:45:41.000000000
+0200
--- src/testdir/test64.in 2013-05-26 18:34:04.000000000 +0200
***************
*** 372,377 ****
--- 372,383 ----
:.+1,.+2yank
Go p:"
:"
+ :" Check a pattern with a line break matches in the right position.
+ /^Multiline
+ /\S.*\nx
+ :.yank
+ y$Go p:"
+ :"
:"
:/\%#=1^Results/,$wq! test.out
ENDTEST
***************
*** 383,386 ****
--- 389,399 ----
<T="">Ta 5</Title>
<T="">Ac 7</Title>
+ Multiline:
+ abc
+ def
+ ghi
+ xjk
+ lmn
+
Results of test64:
*** ../vim-7.3.1025/src/testdir/test64.ok 2013-05-26 17:45:41.000000000
+0200
--- src/testdir/test64.ok 2013-05-26 18:34:00.000000000 +0200
***************
*** 705,707 ****
--- 705,708 ----
<T="5">Ta 5</Title>
<T="7">Ac 7</Title>
+ ghi
*** ../vim-7.3.1025/src/version.c 2013-05-26 17:45:41.000000000 +0200
--- src/version.c 2013-05-26 18:35:52.000000000 +0200
***************
*** 730,731 ****
--- 730,733 ----
{ /* Add new patch number below this line */
+ /**/
+ 1026,
/**/
--
For society, it's probably a good thing that engineers value function over
appearance. For example, you wouldn't want engineers to build nuclear power
plants that only _look_ like they would keep all the radiation inside.
(Scott Adams - The Dilbert principle)
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.