]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.0.1435: scrolling too many lines when 'wrap' and 'diff' are set v9.0.1435
authorBram Moolenaar <Bram@vim.org>
Sat, 1 Apr 2023 18:54:40 +0000 (19:54 +0100)
committerBram Moolenaar <Bram@vim.org>
Sat, 1 Apr 2023 18:54:40 +0000 (19:54 +0100)
Problem:    Scrolling too many lines when 'wrap' and 'diff' are set.
Solution:   Only scroll by screenlines for 'diff' when 'wrap' is not set.
            (closes #12211)

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

index e8b86caf17d8013e82adb39d4d226b2aefa49e7d..77d8b5f85d536f8a174d6e12079b58cbb5258963 100644 (file)
@@ -1763,7 +1763,7 @@ scrolling_screenlines(int byfold UNUSED)
        || (byfold && hasAnyFolding(curwin))
 # endif
 # ifdef FEAT_DIFF
-       || curwin->w_p_diff
+       || (curwin->w_p_diff && !curwin->w_p_wrap)
 # endif
        ;
 }
index d9ffbb379823f2aa879717dea6894804ebdc0511..d60de5046c0aae9ece9a74dc71966f494a06ebd0 100644 (file)
@@ -1588,6 +1588,21 @@ func Test_diff_scroll()
   call StopVimInTerminal(buf)
 endfunc
 
+" This was scrolling too many lines.
+func Test_diff_scroll_wrap_on()
+  20new
+  40vsplit
+  call setline(1, map(range(1, 9), 'repeat(v:val, 200)'))
+  setlocal number diff so=0
+  redraw
+  normal! jj
+  call assert_equal(1, winsaveview().topline)
+  normal! j
+  call assert_equal(2, winsaveview().topline)
+  bwipe!
+  bwipe!
+endfunc
+
 " This was trying to update diffs for a buffer being closed
 func Test_diff_only()
   silent! lfile
index f87bc34e791b57309522fdef06dfd2d03020e087..547d6a7b7a8b70109f93395fbf719d93ae7d9cc9 100644 (file)
@@ -695,6 +695,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1435,
 /**/
     1434,
 /**/