]> granicus.if.org Git - vim/commitdiff
patch 8.2.2495: text jumps up and down when moving the cursor v8.2.2495
authorBram Moolenaar <Bram@vim.org>
Wed, 10 Feb 2021 20:10:12 +0000 (21:10 +0100)
committerBram Moolenaar <Bram@vim.org>
Wed, 10 Feb 2021 20:10:12 +0000 (21:10 +0100)
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)

src/move.c
src/testdir/test_breakindent.vim
src/version.c

index aa90b528aafdcc901ca858de8604ac8fd0e4d54f..d90e4d2d9632ee5feeb3c2a89c1c8a9fa3d8d956 100644 (file)
@@ -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;
index 42b8c8cf254c86b94b03de534dc9892cbe80d55d..98aff02aea1fd7a4a4ce651bd8e096f2e3da532c 100644 (file)
@@ -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 = [
index 88cbd07022399332cbef4dc3178be6c3da6cbe89..708fb95e5c91ae59eee1d4e865cb23acec503055 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2495,
 /**/
     2494,
 /**/