8b9a1c
To: vim_dev@googlegroups.com
8b9a1c
Subject: Patch 7.4.021
8b9a1c
Fcc: outbox
8b9a1c
From: Bram Moolenaar <Bram@moolenaar.net>
8b9a1c
Mime-Version: 1.0
8b9a1c
Content-Type: text/plain; charset=UTF-8
8b9a1c
Content-Transfer-Encoding: 8bit
8b9a1c
------------
8b9a1c
8b9a1c
Patch 7.4.021
8b9a1c
Problem:    NFA regexp: Using \ze in one branch which doesn't match may cause
8b9a1c
	    end of another branch to be wrong. (William Fugh)
8b9a1c
Solution:   Set end position if it wasn't set yet.
8b9a1c
Files:	    src/regexp_nfa.c, src/testdir/test64.in, src/testdir/test64.ok
8b9a1c
8b9a1c
8b9a1c
*** ../vim-7.4.020/src/regexp_nfa.c	2013-09-05 16:05:32.000000000 +0200
8b9a1c
--- src/regexp_nfa.c	2013-09-05 20:56:25.000000000 +0200
8b9a1c
***************
8b9a1c
*** 4209,4218 ****
8b9a1c
  	    break;
8b9a1c
  
8b9a1c
  	case NFA_MCLOSE:
8b9a1c
! 	    if (nfa_has_zend)
8b9a1c
  	    {
8b9a1c
! 		/* Do not overwrite the position set by \ze. If no \ze
8b9a1c
! 		 * encountered end will be set in nfa_regtry(). */
8b9a1c
  		subs = addstate(l, state->out, subs, pim, off);
8b9a1c
  		break;
8b9a1c
  	    }
8b9a1c
--- 4209,4219 ----
8b9a1c
  	    break;
8b9a1c
  
8b9a1c
  	case NFA_MCLOSE:
8b9a1c
! 	    if (nfa_has_zend && (REG_MULTI
8b9a1c
! 			? subs->norm.list.multi[0].end.lnum >= 0
8b9a1c
! 			: subs->norm.list.line[0].end != NULL))
8b9a1c
  	    {
8b9a1c
! 		/* Do not overwrite the position set by \ze. */
8b9a1c
  		subs = addstate(l, state->out, subs, pim, off);
8b9a1c
  		break;
8b9a1c
  	    }
8b9a1c
*** ../vim-7.4.020/src/testdir/test64.in	2013-09-05 16:05:32.000000000 +0200
8b9a1c
--- src/testdir/test64.in	2013-09-05 20:55:18.000000000 +0200
8b9a1c
***************
8b9a1c
*** 328,333 ****
8b9a1c
--- 328,334 ----
8b9a1c
  :call add(tl, [2, 'abc \zsmatch\ze abc', 'abc abc abc match abc abc', 'match'])
8b9a1c
  :call add(tl, [2, '\v(a \zsif .*){2}', 'a if then a if last', 'if last', 'a if last'])
8b9a1c
  :call add(tl, [2, '\>\zs.', 'aword. ', '.'])
8b9a1c
+ :call add(tl, [2, '\s\+\ze\[/\|\s\zs\s\+', 'is   [a t', '  '])
8b9a1c
  :"
8b9a1c
  :"""" Tests for \@= and \& features
8b9a1c
  :call add(tl, [2, 'abc\@=', 'abc', 'ab'])
8b9a1c
*** ../vim-7.4.020/src/testdir/test64.ok	2013-09-05 16:05:32.000000000 +0200
8b9a1c
--- src/testdir/test64.ok	2013-09-05 21:09:56.000000000 +0200
8b9a1c
***************
8b9a1c
*** 752,757 ****
8b9a1c
--- 752,760 ----
8b9a1c
  OK 0 - \>\zs.
8b9a1c
  OK 1 - \>\zs.
8b9a1c
  OK 2 - \>\zs.
8b9a1c
+ OK 0 - \s\+\ze\[/\|\s\zs\s\+
8b9a1c
+ OK 1 - \s\+\ze\[/\|\s\zs\s\+
8b9a1c
+ OK 2 - \s\+\ze\[/\|\s\zs\s\+
8b9a1c
  OK 0 - abc\@=
8b9a1c
  OK 1 - abc\@=
8b9a1c
  OK 2 - abc\@=
8b9a1c
*** ../vim-7.4.020/src/version.c	2013-09-05 16:05:32.000000000 +0200
8b9a1c
--- src/version.c	2013-09-05 21:11:38.000000000 +0200
8b9a1c
***************
8b9a1c
*** 740,741 ****
8b9a1c
--- 740,743 ----
8b9a1c
  {   /* Add new patch number below this line */
8b9a1c
+ /**/
8b9a1c
+     21,
8b9a1c
  /**/
8b9a1c
8b9a1c
-- 
8b9a1c
hundred-and-one symptoms of being an internet addict:
8b9a1c
174. You know what a listserv is.
8b9a1c
8b9a1c
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
8b9a1c
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
8b9a1c
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
8b9a1c
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///