mirror of
https://github.com/neovim/neovim.git
synced 2025-09-29 06:28:35 +00:00
vim-patch:9.1.0357: Page scrolling should place cursor at window boundaries (#28429)
Problem: Page scrolling does not always place the cursor at the top or
bottom of the window (Mathias Rav)
Solution: Place the cursor at the top or bottom of the window.
(Luuk van Baal)
4b6b0c4024
This commit is contained in:
@@ -2492,23 +2492,27 @@ int pagescroll(Direction dir, int count, bool half)
|
||||
} else {
|
||||
cursor_up_inner(curwin, curscount);
|
||||
}
|
||||
|
||||
if (get_scrolloff_value(curwin) > 0) {
|
||||
cursor_correct(curwin);
|
||||
}
|
||||
// Move cursor to first line of closed fold.
|
||||
foldAdjustCursor(curwin);
|
||||
|
||||
nochange = nochange
|
||||
&& prev_col == curwin->w_cursor.col
|
||||
&& prev_lnum == curwin->w_cursor.lnum;
|
||||
} else {
|
||||
// Scroll [count] times 'window' or current window height lines.
|
||||
count *= ((ONE_WINDOW && p_window > 0 && p_window < Rows - 1)
|
||||
? MAX(1, (int)p_window - 2) : get_scroll_overlap(dir));
|
||||
nochange = scroll_with_sms(dir, count);
|
||||
|
||||
// Place cursor at top or bottom of window.
|
||||
validate_botline(curwin);
|
||||
curwin->w_cursor.lnum = (dir == FORWARD ? curwin->w_topline : curwin->w_botline - 1);
|
||||
}
|
||||
|
||||
if (get_scrolloff_value(curwin) > 0) {
|
||||
cursor_correct(curwin);
|
||||
}
|
||||
// Move cursor to first line of closed fold.
|
||||
foldAdjustCursor(curwin);
|
||||
|
||||
nochange = nochange
|
||||
&& prev_col == curwin->w_cursor.col
|
||||
&& prev_lnum == curwin->w_cursor.lnum;
|
||||
|
||||
// Error if both the viewport and cursor did not change.
|
||||
if (nochange) {
|
||||
beep_flush();
|
||||
|
Reference in New Issue
Block a user