aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ex_getln.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/ex_getln.c')
-rw-r--r--src/nvim/ex_getln.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c
index c966c780a0..fe52a6cfa7 100644
--- a/src/nvim/ex_getln.c
+++ b/src/nvim/ex_getln.c
@@ -443,6 +443,10 @@ static void may_do_incsearch_highlighting(int firstc, long count,
if (search_first_line == 0) {
// start at the original cursor position
curwin->w_cursor = s->search_start;
+ } else if (search_first_line > curbuf->b_ml.ml_line_count) {
+ // start after the last line
+ curwin->w_cursor.lnum = curbuf->b_ml.ml_line_count;
+ curwin->w_cursor.col = MAXCOL;
} else {
// start at the first line in the range
curwin->w_cursor.lnum = search_first_line;