mirror of
https://github.com/neovim/neovim.git
synced 2025-09-27 13:38:34 +00:00
vim-patch:8.1.2236: ml_get error if pattern matches beyond last line
Problem: Ml_get error if pattern matches beyond last line.
Solution: Adjust position if needed. (Christian Brabandt, closes )
bb26596242
This commit is contained in:
@@ -3524,6 +3524,11 @@ static buf_T *do_sub(exarg_T *eap, proftime_T timeout,
|
||||
// Note: If not first match on a line, column can't be known here
|
||||
current_match.start.lnum = sub_firstlnum;
|
||||
|
||||
// Match might be after the last line for "\n\zs" matching at
|
||||
// the end of the last line.
|
||||
if (lnum > curbuf->b_ml.ml_line_count) {
|
||||
break;
|
||||
}
|
||||
if (sub_firstline == NULL) {
|
||||
sub_firstline = vim_strsave(ml_get(sub_firstlnum));
|
||||
}
|
||||
|
Reference in New Issue
Block a user