1
0
forked from aniani/vim

patch 8.2.3489: ml_get error after search with range

Problem:    ml_get error after search with range.
Solution:   Limit the line number to the buffer line count.
This commit is contained in:
Bram Moolenaar
2021-10-09 13:58:55 +01:00
parent 26190b2701
commit 35a319b77f
3 changed files with 20 additions and 2 deletions

View File

@@ -4229,8 +4229,10 @@ get_address(
// When '/' or '?' follows another address, start from
// there.
if (lnum != MAXLNUM)
curwin->w_cursor.lnum = lnum;
if (lnum > 0 && lnum != MAXLNUM)
curwin->w_cursor.lnum =
lnum > curbuf->b_ml.ml_line_count
? curbuf->b_ml.ml_line_count : lnum;
// Start a forward search at the end of the line (unless
// before the first line).