aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/regexp_nfa.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/regexp_nfa.c')
-rw-r--r--src/nvim/regexp_nfa.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/src/nvim/regexp_nfa.c b/src/nvim/regexp_nfa.c
index f97dce9e0d..92dbd693ea 100644
--- a/src/nvim/regexp_nfa.c
+++ b/src/nvim/regexp_nfa.c
@@ -1096,6 +1096,7 @@ static int nfa_regatom(void)
int startc = -1;
int endc = -1;
int oldstartc = -1;
+ int save_prev_at_start = prev_at_start;
c = getchr();
switch (c) {
@@ -1412,18 +1413,22 @@ static int nfa_regatom(void)
c = getchr();
}
if (c == 'l' || c == 'c' || c == 'v') {
- if (c == 'l')
- /* \%{n}l \%{n}<l \%{n}>l */
+ if (c == 'l') {
+ // \%{n}l \%{n}<l \%{n}>l
EMIT(cmp == '<' ? NFA_LNUM_LT :
- cmp == '>' ? NFA_LNUM_GT : NFA_LNUM);
- else if (c == 'c')
- /* \%{n}c \%{n}<c \%{n}>c */
+ 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 :
- cmp == '>' ? NFA_COL_GT : NFA_COL);
- else
- /* \%{n}v \%{n}<v \%{n}>v */
+ cmp == '>' ? NFA_COL_GT : NFA_COL);
+ } else {
+ // \%{n}v \%{n}<v \%{n}>v
EMIT(cmp == '<' ? NFA_VCOL_LT :
- cmp == '>' ? NFA_VCOL_GT : NFA_VCOL);
+ cmp == '>' ? NFA_VCOL_GT : NFA_VCOL);
+ }
EMIT(n);
break;
} else if (c == '\'' && n == 0) {