mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch:9.0.1981: not being able to scroll up in diff mode (#25506)
Problem: Cannot scroll up in diff mode with many filler lines and zero
'scrolloff'.
Solution: Invalidate w_cline_row before calling comp_botline().
closes: vim/vim#13256
0583491277
This commit is contained in:
parent
3079fa1f9f
commit
d7a240b1e9
@ -2455,11 +2455,11 @@ int onepage(Direction dir, long count)
|
|||||||
if (curwin->w_topfill == loff.fill) {
|
if (curwin->w_topfill == loff.fill) {
|
||||||
curwin->w_topline--;
|
curwin->w_topline--;
|
||||||
curwin->w_topfill = 0;
|
curwin->w_topfill = 0;
|
||||||
|
curwin->w_valid &= ~(VALID_WROW|VALID_CROW);
|
||||||
}
|
}
|
||||||
comp_botline(curwin);
|
comp_botline(curwin);
|
||||||
curwin->w_cursor.lnum = curwin->w_botline - 1;
|
curwin->w_cursor.lnum = curwin->w_botline - 1;
|
||||||
curwin->w_valid &=
|
curwin->w_valid &= ~(VALID_WCOL|VALID_CHEIGHT|VALID_WROW|VALID_CROW);
|
||||||
~(VALID_WCOL | VALID_CHEIGHT | VALID_WROW | VALID_CROW);
|
|
||||||
} else {
|
} else {
|
||||||
curwin->w_topline = loff.lnum;
|
curwin->w_topline = loff.lnum;
|
||||||
curwin->w_topfill = loff.fill;
|
curwin->w_topfill = loff.fill;
|
||||||
|
@ -1616,6 +1616,42 @@ func Test_diff_scroll_wrap_on()
|
|||||||
call assert_equal(1, winsaveview().topline)
|
call assert_equal(1, winsaveview().topline)
|
||||||
normal! j
|
normal! j
|
||||||
call assert_equal(2, winsaveview().topline)
|
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!
|
||||||
bwipe!
|
bwipe!
|
||||||
endfunc
|
endfunc
|
||||||
|
Loading…
Reference in New Issue
Block a user