1
0
forked from aniani/vim

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)
This commit is contained in:
Bram Moolenaar
2016-02-12 19:08:15 +01:00
parent 7823a3bd2e
commit 7c29f38781
5 changed files with 22 additions and 4 deletions

View File

@@ -1500,6 +1500,10 @@ vim_regcomp_had_eol(void)
} }
#endif #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. * Parse regular expression, i.e. main body or parenthesized thing.
* *
@@ -1918,6 +1922,7 @@ regatom(int *flagp)
int c; int c;
char_u *p; char_u *p;
int extra = 0; int extra = 0;
int save_prev_at_start = prev_at_start;
*flagp = WORST; /* Tentatively. */ *flagp = WORST; /* Tentatively. */
@@ -2331,7 +2336,11 @@ regatom(int *flagp)
else if (c == 'l' || c == 'c' || c == 'v') else if (c == 'l' || c == 'c' || c == 'v')
{ {
if (c == 'l') if (c == 'l')
{
ret = regnode(RE_LNUM); ret = regnode(RE_LNUM);
if (save_prev_at_start)
at_start = TRUE;
}
else if (c == 'c') else if (c == 'c')
ret = regnode(RE_COL); ret = regnode(RE_COL);
else else
@@ -2946,10 +2955,6 @@ regoptail(char_u *p, char_u *val)
/* /*
* Functions for getting characters from the regexp input. * 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". * Start parsing at "str".
*/ */

View File

@@ -1128,6 +1128,7 @@ nfa_regatom(void)
int startc = -1; int startc = -1;
int endc = -1; int endc = -1;
int oldstartc = -1; int oldstartc = -1;
int save_prev_at_start = prev_at_start;
c = getchr(); c = getchr();
switch (c) switch (c)
@@ -1467,9 +1468,13 @@ nfa_regatom(void)
if (c == 'l' || c == 'c' || c == 'v') if (c == 'l' || c == 'c' || c == 'v')
{ {
if (c == 'l') if (c == 'l')
{
/* \%{n}l \%{n}<l \%{n}>l */ /* \%{n}l \%{n}<l \%{n}>l */
EMIT(cmp == '<' ? NFA_LNUM_LT : EMIT(cmp == '<' ? NFA_LNUM_LT :
cmp == '>' ? NFA_LNUM_GT : NFA_LNUM); cmp == '>' ? NFA_LNUM_GT : NFA_LNUM);
if (save_prev_at_start)
at_start = TRUE;
}
else if (c == 'c') else if (c == 'c')
/* \%{n}c \%{n}<c \%{n}>c */ /* \%{n}c \%{n}<c \%{n}>c */
EMIT(cmp == '<' ? NFA_COL_LT : EMIT(cmp == '<' ? NFA_COL_LT :

View File

@@ -98,6 +98,9 @@ p:s/\%#=2\U//g
p:s/\%#=0[^A-Z]//g p:s/\%#=0[^A-Z]//g
p:s/\%#=1[^A-Z]//g p:s/\%#=1[^A-Z]//g
p:s/\%#=2[^A-Z]//g p:s/\%#=2[^A-Z]//g
p:s/\%#=0\%204l^\t...//g
p:s/\%#=1\%205l^\t...//g
p:s/\%#=2\%206l^\t...//g
:/^start-here/+1,$wq! test.out :/^start-here/+1,$wq! test.out
ENDTEST ENDTEST

View File

@@ -94,3 +94,6 @@ ABCDEFGHIXYZ
!"#$%&'()#+'-./0123456789:;<=>?@[\]^_`{|}~<><7F><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> !"#$%&'()#+'-./0123456789:;<=>?@[\]^_`{|}~<><7F><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
!"#$%&'()#+'-./0123456789:;<=>?@[\]^_`{|}~<><7F><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> !"#$%&'()#+'-./0123456789:;<=>?@[\]^_`{|}~<><7F><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
!"#$%&'()#+'-./0123456789:;<=>?@[\]^_`{|}~<><7F><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>

View File

@@ -747,6 +747,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
1305,
/**/ /**/
1304, 1304,
/**/ /**/