diff src/regexp_nfa.c @ 5336:c514693882b9 v7.4.021

updated for version 7.4.021 Problem: NFA regexp: Using \ze in one branch which doesn't match may cause end of another branch to be wrong. (William Fugh) Solution: Set end position if it wasn't set yet.
author Bram Moolenaar <bram@vim.org>
date Thu, 05 Sep 2013 21:15:44 +0200
parents c1ae5baa41f4
children 923738744a60
line wrap: on
line diff
--- a/src/regexp_nfa.c
+++ b/src/regexp_nfa.c
@@ -4209,10 +4209,11 @@ skip_add:
 	    break;
 
 	case NFA_MCLOSE:
-	    if (nfa_has_zend)
+	    if (nfa_has_zend && (REG_MULTI
+			? subs->norm.list.multi[0].end.lnum >= 0
+			: subs->norm.list.line[0].end != NULL))
 	    {
-		/* Do not overwrite the position set by \ze. If no \ze
-		 * encountered end will be set in nfa_regtry(). */
+		/* Do not overwrite the position set by \ze. */
 		subs = addstate(l, state->out, subs, pim, off);
 		break;
 	    }