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)
diff --git a/src/regexp.c b/src/regexp.c
index a07c6f4..9ed5c75 100644
--- a/src/regexp.c
+++ b/src/regexp.c
@@ -1500,6 +1500,10 @@
}
#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 @@
int c;
char_u *p;
int extra = 0;
+ int save_prev_at_start = prev_at_start;
*flagp = WORST; /* Tentatively. */
@@ -2331,7 +2336,11 @@
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 @@
/*
* 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".
*/
diff --git a/src/regexp_nfa.c b/src/regexp_nfa.c
index 8bcf3bc..865d67f 100644
--- a/src/regexp_nfa.c
+++ b/src/regexp_nfa.c
@@ -1128,6 +1128,7 @@
int startc = -1;
int endc = -1;
int oldstartc = -1;
+ int save_prev_at_start = prev_at_start;
c = getchr();
switch (c)
@@ -1467,9 +1468,13 @@
if (c == 'l' || c == 'c' || c == 'v')
{
if (c == 'l')
+ {
/* \%{n}l \%{n}<l \%{n}>l */
EMIT(cmp == '<' ? NFA_LNUM_LT :
cmp == '>' ? NFA_LNUM_GT : NFA_LNUM);
+ if (save_prev_at_start)
+ at_start = TRUE;
+ }
else if (c == 'c')
/* \%{n}c \%{n}<c \%{n}>c */
EMIT(cmp == '<' ? NFA_COL_LT :
diff --git a/src/testdir/test36.in b/src/testdir/test36.in
index 8cdb526..5e8ce44 100644
--- a/src/testdir/test36.in
+++ b/src/testdir/test36.in
Binary files differ
diff --git a/src/testdir/test36.ok b/src/testdir/test36.ok
index f72a74b..df21ed1 100644
--- a/src/testdir/test36.ok
+++ b/src/testdir/test36.ok
Binary files differ
diff --git a/src/version.c b/src/version.c
index 625e3b0..b73ad02 100644
--- a/src/version.c
+++ b/src/version.c
@@ -748,6 +748,8 @@
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1305,
+/**/
1304,
/**/
1303,