mirror of
https://github.com/vim/vim.git
synced 2025-10-11 06:34:16 -04:00
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 <luukvbaal@gmail.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
committed by
Christian Brabandt
parent
950292152c
commit
8ccb89016e
@@ -3281,11 +3281,14 @@ pagescroll(int dir, long count, int half)
|
|||||||
MAX(1, p_window - 2) : get_scroll_overlap(dir));
|
MAX(1, p_window - 2) : get_scroll_overlap(dir));
|
||||||
nochange = scroll_with_sms(dir, count, &count);
|
nochange = scroll_with_sms(dir, count, &count);
|
||||||
|
|
||||||
|
if (!nochange)
|
||||||
|
{
|
||||||
// Place cursor at top or bottom of window.
|
// Place cursor at top or bottom of window.
|
||||||
validate_botline();
|
validate_botline();
|
||||||
curwin->w_cursor.lnum = (dir == FORWARD ? curwin->w_topline
|
curwin->w_cursor.lnum = (dir == FORWARD ? curwin->w_topline
|
||||||
: curwin->w_botline - 1);
|
: curwin->w_botline - 1);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (get_scrolloff_value() > 0)
|
if (get_scrolloff_value() > 0)
|
||||||
cursor_correct();
|
cursor_correct();
|
||||||
|
@@ -4257,6 +4257,9 @@ func Test_page_cursor_topbot()
|
|||||||
call assert_equal(18, line('.'))
|
call assert_equal(18, line('.'))
|
||||||
exe "norm! \<C-B>\<C-F>"
|
exe "norm! \<C-B>\<C-F>"
|
||||||
call assert_equal(9, line('.'))
|
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!
|
bwipe!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
@@ -704,6 +704,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
526,
|
||||||
/**/
|
/**/
|
||||||
525,
|
525,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user