Mercurial > vim
changeset 23905:68f506771741 v8.2.2495
patch 8.2.2495: text jumps up and down when moving the cursor
Commit: https://github.com/vim/vim/commit/8f33ebfade10cd1b4296d8ec8dca815a09e8a405
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Feb 10 21:10:12 2021 +0100
patch 8.2.2495: text jumps up and down when moving the cursor
Problem: Text jumps up and down when moving the cursor in a small window
with wrapping text and 'scrolloff' set.
Solution: Adjust the computation of w_skipcol. (partly by Ghjuvan Lacambre,
closes #7813)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 10 Feb 2021 21:15:04 +0100 |
parents | e2c0053823a5 |
children | 8f797b34b1fe |
files | src/move.c src/testdir/test_breakindent.vim src/version.c |
diffstat | 3 files changed, 5 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/move.c +++ b/src/move.c @@ -1125,10 +1125,10 @@ curs_columns( n = curwin->w_wrow + so; else n = p_lines; - if ((colnr_T)n >= curwin->w_height + curwin->w_skipcol / width) + if ((colnr_T)n >= curwin->w_height + curwin->w_skipcol / width - so) extra += 2; - if (extra == 3 || p_lines < so * 2) + if (extra == 3 || p_lines <= so * 2) { // not enough room for 'scrolloff', put cursor in the middle n = curwin->w_virtcol / width;
--- a/src/testdir/test_breakindent.vim +++ b/src/testdir/test_breakindent.vim @@ -634,7 +634,7 @@ func Test_breakindent19_sbr_nextpage() call s:compare_lines(expect, lines) " Scroll down one screen line setl scrolloff=5 - norm! 5gj + norm! 6gj redraw! let lines = s:screen_lines(1, 20) let expect = [