mirror of
https://github.com/macvim-dev/macvim.git
synced 2026-05-28 00:21:57 +02:00
patch 9.2.0222: "zb" scrolls incorrectly with cursor on fold
Problem: "zb" scrolls incorrectly with cursor on fold. Solution: Set w_botline to the line below the fold (zeertzjq). related: neovim/neovim#38413 closes: #19785 Signed-off-by: zeertzjq <zeertzjq@outlook.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
committed by
Christian Brabandt
parent
03e89ccf33
commit
5a3b75d67b
+6
-2
@@ -2570,8 +2570,12 @@ scroll_cursor_bot(int min_scroll, int set_topbot)
|
||||
if (set_topbot)
|
||||
{
|
||||
used = 0;
|
||||
curwin->w_botline = cln + 1;
|
||||
loff.lnum = cln + 1;
|
||||
linenr_T cln_last = cln;
|
||||
#ifdef FEAT_FOLDING
|
||||
(void)hasFolding(cln, NULL, &cln_last);
|
||||
#endif
|
||||
curwin->w_botline = cln_last + 1;
|
||||
loff.lnum = cln_last + 1;
|
||||
#ifdef FEAT_DIFF
|
||||
loff.fill = 0;
|
||||
#endif
|
||||
|
||||
@@ -4269,6 +4269,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
|
||||
|
||||
@@ -734,6 +734,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
222,
|
||||
/**/
|
||||
221,
|
||||
/**/
|
||||
|
||||
Reference in New Issue
Block a user