aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/regexp.c
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2021-05-25 22:15:14 -0400
committerJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2021-05-26 00:16:32 -0400
commit7e0d50b16e5b8d5c8ac5048fa49486171aabd359 (patch)
tree9956ca54a2a864ebaa9dc0b1b6c45ab745bef98f /src/nvim/regexp.c
parent31ea80649d6c63e83d1ec7f30b355c049aaface6 (diff)
downloadrneovim-7e0d50b16e5b8d5c8ac5048fa49486171aabd359.tar.gz
rneovim-7e0d50b16e5b8d5c8ac5048fa49486171aabd359.tar.bz2
rneovim-7e0d50b16e5b8d5c8ac5048fa49486171aabd359.zip
vim-patch:8.2.2885: searching for \%'> does not match linewise end of line
Problem: searching for \%'> does not match linewise end of line. (Tim Chase) Solution: Match end of line if column is MAXCOL. (closes vim/vim#8238) https://github.com/vim/vim/commit/872bee557e5f8ab0e4a523a6a845868a2801b17e
Diffstat (limited to 'src/nvim/regexp.c')
-rw-r--r--src/nvim/regexp.c28
1 files changed, 18 insertions, 10 deletions
diff --git a/src/nvim/regexp.c b/src/nvim/regexp.c
index e0cc25421a..1f025b24a4 100644
--- a/src/nvim/regexp.c
+++ b/src/nvim/regexp.c
@@ -3974,17 +3974,25 @@ static bool regmatch(
pos = getmark_buf(rex.reg_buf, mark, false);
if (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)
- ? (cmp == '<' || cmp == '>')
- : (pos->col < (colnr_T)(rex.input - rex.line)
- ? cmp != '>'
- : cmp != '<'))
- : (pos->lnum < rex.lnum + rex.reg_firstlnum
- ? cmp != '>'
- : cmp != '<'))) {
+ || pos->lnum <= 0) { // mark isn't set in reg_buf
status = RA_NOMATCH;
+ } else {
+ const 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;
+
+ if (pos->lnum == rex.lnum + rex.reg_firstlnum
+ ? (pos_col == (colnr_T)(rex.input - rex.line)
+ ? (cmp == '<' || cmp == '>')
+ : (pos_col < (colnr_T)(rex.input - rex.line)
+ ? cmp != '>'
+ : cmp != '<'))
+ : (pos->lnum < rex.lnum + rex.reg_firstlnum
+ ? cmp != '>'
+ : cmp != '<')) {
+ status = RA_NOMATCH;
+ }
}
}
break;