File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1500,6 +1500,10 @@ vim_regcomp_had_eol(void)
15001500}
15011501#endif
15021502
1503+ /* variables for parsing reginput */
1504+ static int at_start ; /* True when on the first character */
1505+ static int prev_at_start ; /* True when on the second character */
1506+
15031507/*
15041508 * Parse regular expression, i.e. main body or parenthesized thing.
15051509 *
@@ -1918,6 +1922,7 @@ regatom(int *flagp)
19181922 int c ;
19191923 char_u * p ;
19201924 int extra = 0 ;
1925+ int save_prev_at_start = prev_at_start ;
19211926
19221927 * flagp = WORST ; /* Tentatively. */
19231928
@@ -2331,7 +2336,11 @@ regatom(int *flagp)
23312336 else if (c == 'l' || c == 'c' || c == 'v' )
23322337 {
23332338 if (c == 'l' )
2339+ {
23342340 ret = regnode (RE_LNUM );
2341+ if (save_prev_at_start )
2342+ at_start = TRUE;
2343+ }
23352344 else if (c == 'c' )
23362345 ret = regnode (RE_COL );
23372346 else
@@ -2946,10 +2955,6 @@ regoptail(char_u *p, char_u *val)
29462955/*
29472956 * Functions for getting characters from the regexp input.
29482957 */
2949-
2950- static int at_start ; /* True when on the first character */
2951- static int prev_at_start ; /* True when on the second character */
2952-
29532958/*
29542959 * Start parsing at "str".
29552960 */
Original file line number Diff line number Diff line change @@ -1128,6 +1128,7 @@ nfa_regatom(void)
11281128 int startc = -1 ;
11291129 int endc = -1 ;
11301130 int oldstartc = -1 ;
1131+ int save_prev_at_start = prev_at_start ;
11311132
11321133 c = getchr ();
11331134 switch (c )
@@ -1467,9 +1468,13 @@ nfa_regatom(void)
14671468 if (c == 'l' || c == 'c' || c == 'v' )
14681469 {
14691470 if (c == 'l' )
1471+ {
14701472 /* \%{n}l \%{n}<l \%{n}>l */
14711473 EMIT (cmp == '<' ? NFA_LNUM_LT :
14721474 cmp == '>' ? NFA_LNUM_GT : NFA_LNUM );
1475+ if (save_prev_at_start )
1476+ at_start = TRUE;
1477+ }
14731478 else if (c == 'c' )
14741479 /* \%{n}c \%{n}<c \%{n}>c */
14751480 EMIT (cmp == '<' ? NFA_COL_LT :
Original file line number Diff line number Diff line change @@ -98,6 +98,9 @@ p:s/\%#=2\U//g
9898p:s/\%#=0[^A-Z]//g
9999p:s/\%#=1[^A-Z]//g
100100p:s/\%#=2[^A-Z]//g
101+ p:s/\%#=0\%204l^\t...//g
102+ p:s/\%#=1\%205l^\t...//g
103+ p:s/\%#=2\%206l^\t...//g
101104:/^start-here/+1,$wq! test.out
102105ENDTEST
103106
Original file line number Diff line number Diff line change @@ -94,3 +94,6 @@ ABCDEFGHIXYZ
9494ABCDEFGHIXYZ
9595ABCDEFGHIXYZ
9696ABCDEFGHIXYZ
97+ !"#$%&'()#+'-./0123456789:;<=>?@ABCDEFGHIXYZ[\]^_`abcdefghiwxyz{|}~����������
98+ !"#$%&'()#+'-./0123456789:;<=>?@ABCDEFGHIXYZ[\]^_`abcdefghiwxyz{|}~����������
99+ !"#$%&'()#+'-./0123456789:;<=>?@ABCDEFGHIXYZ[\]^_`abcdefghiwxyz{|}~����������
Original file line number Diff line number Diff line change @@ -747,6 +747,8 @@ static char *(features[]) =
747747
748748static int included_patches [] =
749749{ /* Add new patch number below this line */
750+ /**/
751+ 1305 ,
750752/**/
751753 1304 ,
752754/**/
You can’t perform that action at this time.
0 commit comments