Mercurial > vim
changeset 30620:70d6345a2976 v9.0.0645
patch 9.0.0645: CTRL-Y does not stop at line 1
Commit: https://github.com/vim/vim/commit/8df9748edb2ac8bd025e34e06194ac210667c97a
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Oct 3 12:11:13 2022 +0100
patch 9.0.0645: CTRL-Y does not stop at line 1
Problem: CTRL-Y does not stop at line 1. (John Marriott)
Solution: Stop at line 1 when 'smoothscroll' is not set. (closes https://github.com/vim/vim/issues/11261)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 03 Oct 2022 13:15:03 +0200 |
parents | c25742e02de9 |
children | 802b1a4878c2 |
files | src/move.c src/testdir/test_scroll_opt.vim src/version.c |
diffstat | 3 files changed, 21 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/move.c +++ b/src/move.c @@ -1485,11 +1485,14 @@ scrolldown( else #endif { - if (curwin->w_topline == 1 && curwin->w_skipcol < width1) + // break when at the very top + if (curwin->w_topline == 1 + && (!curwin->w_p_sms || curwin->w_skipcol < width1)) break; if (curwin->w_p_wrap && curwin->w_p_sms - && curwin->w_skipcol >= width1) + && curwin->w_skipcol >= width1) { + // scroll a screen line down if (curwin->w_skipcol >= width1 + width2) curwin->w_skipcol -= width2; else @@ -1499,6 +1502,7 @@ scrolldown( } else { + // scroll a text line down --curwin->w_topline; curwin->w_skipcol = 0; #ifdef FEAT_DIFF
--- a/src/testdir/test_scroll_opt.vim +++ b/src/testdir/test_scroll_opt.vim @@ -37,6 +37,19 @@ func Test_reset_scroll() quit! endfunc +func Test_CtrlE_CtrlY_stop_at_end() + enew + call setline(1, ['one', 'two']) + set number + exe "normal \<C-Y>" + call assert_equal([" 1 one "], ScreenLines(1, 10)) + exe "normal \<C-E>\<C-E>\<C-E>" + call assert_equal([" 2 two "], ScreenLines(1, 10)) + + bwipe! + set nonumber +endfunc + func Test_smoothscroll_CtrlE_CtrlY() CheckScreendump