Blame SOURCES/7.4.021

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