From: Bram Moolenaar Date: Wed, 10 Feb 2021 20:10:12 +0000 (+0100) Subject: patch 8.2.2495: text jumps up and down when moving the cursor X-Git-Tag: v8.2.2495 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8f33ebfade10cd1b4296d8ec8dca815a09e8a405;p=vim 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) --- diff --git a/src/move.c b/src/move.c index aa90b528a..d90e4d2d9 100644 --- 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; diff --git a/src/testdir/test_breakindent.vim b/src/testdir/test_breakindent.vim index 42b8c8cf2..98aff02ae 100644 --- 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 = [ diff --git a/src/version.c b/src/version.c index 88cbd0702..708fb95e5 100644 --- a/src/version.c +++ b/src/version.c @@ -750,6 +750,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 2495, /**/ 2494, /**/