mirror of
https://github.com/neovim/neovim.git
synced 2026-03-31 04:42:03 +00:00
vim-patch:9.2.0222: "zb" scrolls incorrectly with cursor on fold (#38423)
Problem: "zb" scrolls incorrectly with cursor on fold.
Solution: Set w_botline to the line below the fold (zeertzjq).
related: neovim/neovim#38413
closes: vim/vim#19785
5a3b75d67b
This commit is contained in:
@@ -1923,8 +1923,10 @@ void scroll_cursor_bot(win_T *wp, int min_scroll, bool set_topbot)
|
||||
|
||||
if (set_topbot) {
|
||||
int used = 0;
|
||||
wp->w_botline = cln + 1;
|
||||
loff.lnum = cln + 1;
|
||||
linenr_T cln_last = cln;
|
||||
hasFolding(wp, cln, NULL, &cln_last);
|
||||
wp->w_botline = cln_last + 1;
|
||||
loff.lnum = cln_last + 1;
|
||||
loff.fill = 0;
|
||||
while (true) {
|
||||
topline_back_winheight(wp, &loff, false);
|
||||
|
||||
@@ -4282,6 +4282,20 @@ func Test_single_line_filler_zb()
|
||||
bw!
|
||||
endfunc
|
||||
|
||||
" Test for zb with fewer buffer lines than window height, non-zero 'scrolloff'
|
||||
" and cursor on fold.
|
||||
func Test_zb_with_cursor_on_fold()
|
||||
15new
|
||||
call setline(1, range(1, 5) + ['', 'foo{{{', 'bar}}}', '', 'baz'])
|
||||
setlocal foldmethod=marker scrolloff=1
|
||||
call assert_equal(8, foldclosedend(7))
|
||||
call cursor(7, 1)
|
||||
normal! zb
|
||||
call assert_equal(1, line('w0'))
|
||||
|
||||
bwipe!
|
||||
endfunc
|
||||
|
||||
" Test for Ctrl-U not getting stuck at end of buffer with 'scrolloff'.
|
||||
func Test_halfpage_scrolloff_eob()
|
||||
set scrolloff=5
|
||||
|
||||
Reference in New Issue
Block a user