patch 9.1.0526: Unwanted cursor movement with pagescroll at start of buffer
Commit: https://github.com/vim/vim/commit/8ccb89016e4b4b7f87acd1da78486c077350ceef Author: Luuk van Baal <luukvb...@gmail.com> Date: Thu Jul 4 17:35:56 2024 +0200 patch 9.1.0526: Unwanted cursor movement with pagescroll at start of buffer Problem: Cursor is moved to bottom of window trying to pagescroll when already at the start of the buffer (Asheq Imran, after v9.1.0357) Solution: Don't move cursor when buffer content did not move. (Luuk van Baal) closes: #15139 Signed-off-by: Luuk van Baal <luukvb...@gmail.com> Signed-off-by: Christian Brabandt <c...@256bit.org> diff --git a/src/move.c b/src/move.c index 71654dd76..f2780e584 100644 --- a/src/move.c +++ b/src/move.c @@ -3281,10 +3281,13 @@ pagescroll(int dir, long count, int half) MAX(1, p_window - 2) : get_scroll_overlap(dir)); nochange = scroll_with_sms(dir, count, &count); - // Place cursor at top or bottom of window. - validate_botline(); - curwin->w_cursor.lnum = (dir == FORWARD ? curwin->w_topline + if (!nochange) + { + // Place cursor at top or bottom of window. + validate_botline(); + curwin->w_cursor.lnum = (dir == FORWARD ? curwin->w_topline : curwin->w_botline - 1); + } } if (get_scrolloff_value() > 0) diff --git a/src/testdir/test_normal.vim b/src/testdir/test_normal.vim index 83594d202..398bf2992 100644 --- a/src/testdir/test_normal.vim +++ b/src/testdir/test_normal.vim @@ -4257,6 +4257,9 @@ func Test_page_cursor_topbot() call assert_equal(18, line('.')) exe "norm! \<C-B>\<C-F>" call assert_equal(9, line('.')) + " Not when already at the start of the buffer. + exe "norm! ggj\<C-B>" + call assert_equal(2, line('.')) bwipe! endfunc diff --git a/src/version.c b/src/version.c index 66ed6a6f6..462b094be 100644 --- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 526, /**/ 525, /**/ -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_dev/E1sPOds-002VxP-4b%40256bit.org.