summaryrefslogtreecommitdiff
path: root/src/regexp_nfa.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2021-05-24 22:56:15 +0200
committerBram Moolenaar <Bram@vim.org>2021-05-24 22:56:15 +0200
commit872bee557e5f8ab0e4a523a6a845868a2801b17e (patch)
treed98b78f7384d6ba1a4861ea8b4911a8a9b2417a9 /src/regexp_nfa.c
parent1e469c72ee2914fcffbcd49258036acdabd6f500 (diff)
downloadvim-git-872bee557e5f8ab0e4a523a6a845868a2801b17e.tar.gz
patch 8.2.2885: searching for \%'> does not match linewise end of linev8.2.2885
Problem: searching for \%'> does not match linewise end of line. (Tim Chase) Solution: Match end of line if column is MAXCOL. (closes #8238)
Diffstat (limited to 'src/regexp_nfa.c')
-rw-r--r--src/regexp_nfa.c30
1 files changed, 19 insertions, 11 deletions
diff --git a/src/regexp_nfa.c b/src/regexp_nfa.c
index a519b8537..2ed18685d 100644
--- a/src/regexp_nfa.c
+++ b/src/regexp_nfa.c
@@ -6806,22 +6806,30 @@ nfa_regmatch(
{
pos_T *pos = getmark_buf(rex.reg_buf, t->state->val, FALSE);
- // Compare the mark position to the match position.
- result = (pos != NULL // mark doesn't exist
- && pos->lnum > 0 // mark isn't set in reg_buf
- && (pos->lnum == rex.lnum + rex.reg_firstlnum
- ? (pos->col == (colnr_T)(rex.input - rex.line)
+ // Compare the mark position to the match position, if the mark
+ // exists and mark is set in reg_buf.
+ if (pos != NULL && pos->lnum > 0)
+ {
+ colnr_T pos_col = pos->lnum == rex.lnum + rex.reg_firstlnum
+ && pos->col == MAXCOL
+ ? (colnr_T)STRLEN(reg_getline(
+ pos->lnum - rex.reg_firstlnum))
+ : pos->col;
+
+ result = (pos->lnum == rex.lnum + rex.reg_firstlnum
+ ? (pos_col == (colnr_T)(rex.input - rex.line)
? t->state->c == NFA_MARK
- : (pos->col < (colnr_T)(rex.input - rex.line)
+ : (pos_col < (colnr_T)(rex.input - rex.line)
? t->state->c == NFA_MARK_GT
: t->state->c == NFA_MARK_LT))
: (pos->lnum < rex.lnum + rex.reg_firstlnum
? t->state->c == NFA_MARK_GT
- : t->state->c == NFA_MARK_LT)));
- if (result)
- {
- add_here = TRUE;
- add_state = t->state->out;
+ : t->state->c == NFA_MARK_LT));
+ if (result)
+ {
+ add_here = TRUE;
+ add_state = t->state->out;
+ }
}
break;
}