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