cursor_down_inner(curwin, curscount);
else
cursor_up_inner(curwin, curscount);
-
- if (get_scrolloff_value() > 0)
- cursor_correct();
-#ifdef FEAT_FOLDING
- // Move cursor to first line of closed fold.
- foldAdjustCursor();
-#endif
-
- nochange = nochange
- && prev_col == curwin->w_cursor.col
- && prev_lnum == curwin->w_cursor.lnum;
}
else
{
count *= ((ONE_WINDOW && p_window > 0 && p_window < Rows - 1) ?
MAX(1, p_window - 2) : get_scroll_overlap(dir));
nochange = scroll_with_sms(dir, count);
+
+ // 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)
+ cursor_correct();
+#ifdef FEAT_FOLDING
+ // Move cursor to first line of closed fold.
+ foldAdjustCursor();
+#endif
+ 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();
call assert_equal(11, line('.'))
call assert_equal(1, winline())
exe "normal \<C-B>"
- call assert_equal(10, line('.'))
- call assert_equal(4, winline())
+ call assert_equal(11, line('.'))
+ call assert_equal(5, winline())
exe "normal \<C-B>\<C-B>"
call assert_equal(5, line('.'))
call assert_equal(5, winline())
bwipe!
endfunc
+" Test for Ctrl-F/B moving the cursor to the window boundaries.
+func Test_page_cursor_topbot()
+ 10new
+ call setline(1, range(1, 100))
+ exe "norm! gg2\<C-F>"
+ call assert_equal(17, line('.'))
+ exe "norm! \<C-B>"
+ call assert_equal(18, line('.'))
+ exe "norm! \<C-B>\<C-F>"
+ call assert_equal(9, line('.'))
+ bwipe!
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab nofoldenable