aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/regexp.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-07-17 10:38:40 +0800
committerzeertzjq <zeertzjq@outlook.com>2024-07-17 11:04:55 +0800
commitccdbab7810bd40a44a0a502d478b0d06073388e9 (patch)
treeffc8f476b62855ecff99131381b5195e61544758 /src/nvim/regexp.c
parentdce615bc425795ad65f96ed1879ba37ff6a030d8 (diff)
downloadrneovim-ccdbab7810bd40a44a0a502d478b0d06073388e9.tar.gz
rneovim-ccdbab7810bd40a44a0a502d478b0d06073388e9.tar.bz2
rneovim-ccdbab7810bd40a44a0a502d478b0d06073388e9.zip
vim-patch:9.0.0407: matchstr() does match column offset
Problem: matchstr() does match column offset. (Yasuhiro Matsumoto) Solution: Accept line number zero. (closes vim/vim#10938) https://github.com/vim/vim/commit/75a115e8d632e96b4f45dc5145ba261876a83dcf Co-authored-by: Bram Moolenaar <Bram@vim.org>
Diffstat (limited to 'src/nvim/regexp.c')
-rw-r--r--src/nvim/regexp.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/nvim/regexp.c b/src/nvim/regexp.c
index 52420cf64f..22859a1e54 100644
--- a/src/nvim/regexp.c
+++ b/src/nvim/regexp.c
@@ -6259,7 +6259,7 @@ static bool regmatch(uint8_t *scan, const proftime_T *tm, int *timed_out)
linenr_T lnum = rex.reg_firstlnum + rex.lnum;
int vcol = 0;
- if (lnum > 0 && lnum <= wp->w_buffer->b_ml.ml_line_count) {
+ if (lnum >= 0 && lnum <= wp->w_buffer->b_ml.ml_line_count) {
vcol = win_linetabsize(wp, lnum, (char *)rex.line,
(colnr_T)(rex.input - rex.line));
}
@@ -15108,7 +15108,7 @@ static int nfa_regmatch(nfa_regprog_T *prog, nfa_state_T *start, regsubs_T *subm
linenr_T lnum = rex.reg_firstlnum + rex.lnum;
int vcol = 0;
- if (lnum > 0 && lnum <= wp->w_buffer->b_ml.ml_line_count) {
+ if (lnum >= 0 && lnum <= wp->w_buffer->b_ml.ml_line_count) {
vcol = win_linetabsize(wp, lnum, (char *)rex.line, col);
}
assert(t->state->val >= 0);