summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/move.c9
-rw-r--r--src/testdir/test_normal.vim3
-rw-r--r--src/version.c2
3 files changed, 11 insertions, 3 deletions
diff --git a/src/move.c b/src/move.c
index 71654dd769..f2780e584e 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 83594d202e..398bf2992f 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 66ed6a6f64..462b094be9 100644
--- a/src/version.c
+++ b/src/version.c
@@ -705,6 +705,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 526,
+/**/
525,
/**/
524,