diff src/regexp.c @ 8021:b6b4f354df23 v7.4.1305

commit https://github.com/vim/vim/commit/7c29f387819b5817b003d2ba73e2b5cf3cb3d0dd Author: Bram Moolenaar <Bram@vim.org> Date: Fri Feb 12 19:08:15 2016 +0100 patch 7.4.1305 Problem: "\%1l^#.*" does not match on a line starting with "#". Solution: Do not clear the start-of-line flag. (Christian Brabandt)
author Christian Brabandt <cb@256bit.org>
date Fri, 12 Feb 2016 19:15:05 +0100
parents c079097365f3
children 05b88224cea1
line wrap: on
line diff
--- a/src/regexp.c
+++ b/src/regexp.c
@@ -1500,6 +1500,10 @@ vim_regcomp_had_eol(void)
 }
 #endif
 
+/* variables for parsing reginput */
+static int	at_start;	/* True when on the first character */
+static int	prev_at_start;  /* True when on the second character */
+
 /*
  * Parse regular expression, i.e. main body or parenthesized thing.
  *
@@ -1918,6 +1922,7 @@ regatom(int *flagp)
     int		    c;
     char_u	    *p;
     int		    extra = 0;
+    int		    save_prev_at_start = prev_at_start;
 
     *flagp = WORST;		/* Tentatively. */
 
@@ -2331,7 +2336,11 @@ regatom(int *flagp)
 			      else if (c == 'l' || c == 'c' || c == 'v')
 			      {
 				  if (c == 'l')
+				  {
 				      ret = regnode(RE_LNUM);
+				      if (save_prev_at_start)
+					  at_start = TRUE;
+				  }
 				  else if (c == 'c')
 				      ret = regnode(RE_COL);
 				  else
@@ -2946,10 +2955,6 @@ regoptail(char_u *p, char_u *val)
 /*
  * Functions for getting characters from the regexp input.
  */
-
-static int	at_start;	/* True when on the first character */
-static int	prev_at_start;  /* True when on the second character */
-
 /*
  * Start parsing at "str".
  */