1
0
forked from aniani/vim

patch 9.0.0555: scrolling with 'nosplitscroll' in callback changing curwin

Problem:    Scrolling with 'nosplitscroll' in callback changing curwin.
Solution:   Invalidate w_cline_row in the right place. (Luuk van Baal,
            closes #11185)
This commit is contained in:
Luuk van Baal
2022-09-23 12:57:09 +01:00
committed by Bram Moolenaar
parent f8addf1ca1
commit 20e58561ab
7 changed files with 68 additions and 1 deletions

View File

@@ -0,0 +1,8 @@
|0+0&#ffffff0| @73
|1| @73
|2| @73
|[+1&&|N|o| |N|a|m|e|]| |[|+|]| @43|1|,|1| @11|T|o|p
>4+0&&| @73
|5| @73
|[+3&&|N|o| |N|a|m|e|]| |[|+|]| @43|5|,|1| @11|6@1|%
| +0&&@74

View File

@@ -0,0 +1,8 @@
>0+0&#ffffff0| @73
|1| @73
|2| @73
|[+3&&|N|o| |N|a|m|e|]| |[|+|]| @43|1|,|1| @11|T|o|p
|4+0&&| @73
|5| @73
|[+1&&|N|o| |N|a|m|e|]| |[|+|]| @43|1|,|1| @11|6@1|%
| +0&&@74

View File

@@ -0,0 +1,8 @@
>1+0&#ffffff0| @73
|2| @73
|[+3&&|N|o| |N|a|m|e|]| |[|+|]| @43|2|,|1| @11|1|6|%
|4+0&&| @73
|5| @73
|6| @73
|[+1&&|N|o| |N|a|m|e|]| |[|+|]| @43|6|,|1| @11|8|0|%
| +0&&@74

View File

@@ -0,0 +1,8 @@
|1+0&#ffffff0| @73
|2| @73
|[+1&&|N|o| |N|a|m|e|]| |[|+|]| @43|8|,|1| @11|1|6|%
|4+0&&| @73
>5| @73
|6| @73
|[+3&&|N|o| |N|a|m|e|]| |[|+|]| @43|6|,|1| @11|8|0|%
| +0&&@74

View File

@@ -1,6 +1,7 @@
" Tests for window cmd (:wincmd, :split, :vsplit, :resize and etc...)
source check.vim
source screendump.vim
func Test_window_cmd_ls0_with_split()
set ls=0
@@ -1817,4 +1818,34 @@ function Test_nosplitscroll_misc()
set splitscroll&
endfunc
function Test_nosplitscroll_callback()
CheckScreendump
let lines =<< trim END
set nosplitscroll
call setline(1, range(&lines))
function WincmdCb(a, b)
split | wincmd p
endfunction
function TermCb(a, b)
close | split
endfunction
nnoremap t <cmd>call popup_create(term_start(&shell, { 'hidden': 1, 'exit_cb': 'TermCb' }), {})<CR>
nnoremap j <cmd>call job_start([&shell, &shellcmdflag, "echo"], { 'exit_cb': 'WincmdCb' })<CR>
END
call writefile(lines, 'XTestNosplitscrollCallback', 'D')
let buf = RunVimInTerminal('-S XTestNosplitscrollCallback', #{rows: 8})
call term_sendkeys(buf, "j")
call VerifyScreenDump(buf, 'Test_nosplitscroll_callback_1', {})
call term_sendkeys(buf, ":quit\<CR>Htexit\<CR>")
call VerifyScreenDump(buf, 'Test_nosplitscroll_callback_2', {})
call term_sendkeys(buf, ":set sb\<CR>:quit\<CR>Gj")
call VerifyScreenDump(buf, 'Test_nosplitscroll_callback_3', {})
call term_sendkeys(buf, ":quit\<CR>Gtexit\<CR>")
call VerifyScreenDump(buf, 'Test_nosplitscroll_callback_4', {})
endfunc
" vim: shiftwidth=2 sts=2 expandtab

View File

@@ -699,6 +699,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
555,
/**/
554,
/**/

View File

@@ -6360,7 +6360,7 @@ win_fix_scroll(int resize)
win_T *wp;
linenr_T lnum;
skip_update_topline = TRUE; // avoid scrolling in curs_rows()
skip_update_topline = TRUE; // avoid scrolling in curs_columns()
FOR_ALL_WINDOWS(wp)
{
// Skip when window height has not changed.
@@ -6378,6 +6378,8 @@ win_fix_scroll(int resize)
scroll_to_fraction(wp, wp->w_prev_height);
wp->w_cursor.lnum = lnum;
}
else if (wp == curwin)
wp->w_valid &= ~VALID_CROW;
invalidate_botline_win(wp);
validate_botline_win(wp);
}