patch 9.0.1981: not being able to scroll up in diff mode

Commit: 
https://github.com/vim/vim/commit/0583491277dea9d14e000051c26405b90d839072
Author: zeertzjq <zeert...@outlook.com>
Date:   Wed Oct 4 20:12:37 2023 +0200

    patch 9.0.1981: not being able to scroll up in diff mode
    
    Problem:  Cannot scroll up in diff mode with many filler lines and zero
              'scrolloff'.
    Solution: Invalidate w_cline_row before calling comp_botline().
    
    closes: #13256
    
    Signed-off-by: Christian Brabandt <c...@256bit.org>
    Co-authored-by: zeertzjq <zeert...@outlook.com>

diff --git a/src/move.c b/src/move.c
index ba1eadb9f..e5309df48 100644
--- a/src/move.c
+++ b/src/move.c
@@ -3262,6 +3262,7 @@ onepage(int dir, long count)
 #ifdef FEAT_DIFF
                        curwin->w_topfill = 0;
 #endif
+                       curwin->w_valid &= ~(VALID_WROW|VALID_CROW);
                    }
                    comp_botline(curwin);
                    curwin->w_cursor.lnum = curwin->w_botline - 1;
diff --git a/src/testdir/test_diffmode.vim b/src/testdir/test_diffmode.vim
index cb042e115..e05d91601 100644
--- a/src/testdir/test_diffmode.vim
+++ b/src/testdir/test_diffmode.vim
@@ -1614,6 +1614,42 @@ func Test_diff_scroll_wrap_on()
   call assert_equal(1, winsaveview().topline)
   normal! j
   call assert_equal(2, winsaveview().topline)
+
+  bwipe!
+  bwipe!
+endfunc
+
+func Test_diff_scroll_many_filler()
+  20new
+  vnew
+  call setline(1, ['^^^', '^^^', '$$$', '$$$'])
+  diffthis
+  setlocal scrolloff=0
+  wincmd p
+  call setline(1, ['^^^', '^^^'] + repeat(['###'], 41) + ['$$$', '$$$'])
+  diffthis
+  setlocal scrolloff=0
+  wincmd p
+  redraw
+
+  " Note: need a redraw after each scroll, otherwise the test always passes.
+  normal! G
+  redraw
+  call assert_equal(3, winsaveview().topline)
+  call assert_equal(18, winsaveview().topfill)
+  exe "normal! \<C-B>"
+  redraw
+  call assert_equal(3, winsaveview().topline)
+  call assert_equal(19, winsaveview().topfill)
+  exe "normal! \<C-B>"
+  redraw
+  call assert_equal(2, winsaveview().topline)
+  call assert_equal(0, winsaveview().topfill)
+  exe "normal! \<C-B>"
+  redraw
+  call assert_equal(1, winsaveview().topline)
+  call assert_equal(0, winsaveview().topfill)
+
   bwipe!
   bwipe!
 endfunc
diff --git a/src/version.c b/src/version.c
index d7b3c9bd3..15e87d62a 100644
--- a/src/version.c
+++ b/src/version.c
@@ -704,6 +704,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1981,
 /**/
     1980,
 /**/

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/E1qo6On-007ihV-0e%40256bit.org.

Raspunde prin e-mail lui