vim-patch:9.0.1189: invalid memory access with folding and using "L" (#21787)

Problem:    Invalid memory access with folding and using "L".
Solution:   Prevent the cursor from moving to line zero.

232bdaaca9

Co-authored-by: Bram Moolenaar <Bram@vim.org>
This commit is contained in:
zeertzjq
2023-01-14 07:02:45 +08:00
committed by GitHub
parent fd3d30a22c
commit b884d0b370
2 changed files with 11 additions and 1 deletions

View File

@@ -3645,7 +3645,9 @@ static void nv_scroll(cmdarg_T *cap)
&& curwin->w_cursor.lnum > curwin->w_topline; n--) {
(void)hasFolding(curwin->w_cursor.lnum,
&curwin->w_cursor.lnum, NULL);
curwin->w_cursor.lnum--;
if (curwin->w_cursor.lnum > curwin->w_topline) {
curwin->w_cursor.lnum--;
}
}
} else {
curwin->w_cursor.lnum -= (linenr_T)cap->count1 - 1;