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