mirror of
https://github.com/vim/vim
synced 2025-07-16 01:01:58 +00:00
patch 9.1.1482: scrolling with 'splitkeep' and line()
Problem: Topline is preemptively updated by line() in WinResized autocmd with 'splitkeep' != "cursor". Solution: Set `skip_update_topline` when 'splitkeep' != "cursor". (Luuk van Baal) related: neovim/neovim#34666 closes: #17613 Signed-off-by: Luuk van Baal <luukvbaal@gmail.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
committed by
Christian Brabandt
parent
26ebe21caa
commit
fe803c8c04
@ -8833,19 +8833,18 @@ f_line(typval_T *argvars, typval_T *rettv)
|
||||
{
|
||||
if (switch_win_noblock(&switchwin, wp, tp, TRUE) == OK)
|
||||
{
|
||||
// With 'splitkeep' != cursor and in diff mode, prevent that the
|
||||
// window scrolls and keep the topline.
|
||||
if (*p_spk != 'c'
|
||||
#ifdef FEAT_DIFF
|
||||
// in diff mode, prevent that the window scrolls
|
||||
// and keep the topline
|
||||
if (curwin->w_p_diff && switchwin.sw_curwin->w_p_diff)
|
||||
skip_update_topline = TRUE;
|
||||
|| (curwin->w_p_diff && switchwin.sw_curwin->w_p_diff)
|
||||
#endif
|
||||
)
|
||||
skip_update_topline = TRUE;
|
||||
check_cursor();
|
||||
fp = var2fpos(&argvars[0], TRUE, &fnum, FALSE);
|
||||
}
|
||||
#ifdef FEAT_DIFF
|
||||
if (curwin->w_p_diff && switchwin.sw_curwin->w_p_diff)
|
||||
skip_update_topline = FALSE;
|
||||
#endif
|
||||
restore_win_noblock(&switchwin, TRUE);
|
||||
}
|
||||
}
|
||||
|
6
src/testdir/dumps/Test_splitkeep_line_1.dump
Normal file
6
src/testdir/dumps/Test_splitkeep_line_1.dump
Normal file
@ -0,0 +1,6 @@
|
||||
>0+0&#ffffff0| @38
|
||||
|1| @38
|
||||
|2| @38
|
||||
|3| @38
|
||||
|4| @38
|
||||
@22|1|,|1| @10|T|o|p|
|
6
src/testdir/dumps/Test_splitkeep_line_2.dump
Normal file
6
src/testdir/dumps/Test_splitkeep_line_2.dump
Normal file
@ -0,0 +1,6 @@
|
||||
>0+0&#ffffff0| @38
|
||||
|1| @38
|
||||
|[+3&&|N|o| |N|a|m|e|]| |[|+|]| @8|1|,|1| @11|T|o|p
|
||||
|3+0&&| @38
|
||||
|[+1&&|N|o| |N|a|m|e|]| |[|+|]| @8|1|,|1| @12|0|%
|
||||
|:+0&&|w|i|n|c|m|d| |s| @30
|
@ -2120,6 +2120,24 @@ func Test_splitkeep_skipcol()
|
||||
call VerifyScreenDump(buf, 'Test_splitkeep_skipcol_1', {})
|
||||
endfunc
|
||||
|
||||
func Test_splitkeep_line()
|
||||
CheckScreendump
|
||||
|
||||
let lines =<< trim END
|
||||
set splitkeep=screen nosplitbelow
|
||||
autocmd WinResized * call line('w0', 1000)
|
||||
call setline(1, range(1000))
|
||||
END
|
||||
|
||||
call writefile(lines, 'XTestSplitkeepSkipcol', 'D')
|
||||
let buf = RunVimInTerminal('-S XTestSplitkeepSkipcol', #{rows: 6, cols: 40})
|
||||
|
||||
call VerifyScreenDump(buf, 'Test_splitkeep_line_1', {})
|
||||
|
||||
call term_sendkeys(buf, ":wincmd s\<CR>")
|
||||
call VerifyScreenDump(buf, 'Test_splitkeep_line_2', {})
|
||||
endfunc
|
||||
|
||||
func Test_new_help_window_on_error()
|
||||
help change.txt
|
||||
execute "normal! /CTRL-@\<CR>"
|
||||
|
@ -709,6 +709,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
1482,
|
||||
/**/
|
||||
1481,
|
||||
/**/
|
||||
|
Reference in New Issue
Block a user