Mercurial > vim
diff src/testdir/test_window_cmd.vim @ 34389:8b0e390b61fe v9.1.0121
patch 9.1.0121: Infinite loop or signed overflow with 'smoothscroll'
Commit: https://github.com/vim/vim/commit/02fcae02a926e4e8379d77fb716da4202029882d
Author: Sean Dewar <6256228+seandewar@users.noreply.github.com>
Date: Wed Feb 21 19:40:44 2024 +0100
patch 9.1.0121: Infinite loop or signed overflow with 'smoothscroll'
Problem: infinite loop in win_update with 'smoothscroll' set when
window width is equal to textoff, or signed integer overflow
if smaller.
Solution: don't revalidate wp->w_skipcol in that case, as no buffer text
is being shown. (Sean Dewar)
Don't instead reset w_skipcol; that would lose the scroll position
within the line, which may be undesirable if the window is made wider
later.
Also include changes from the splitmove PR #14042 that I (in my infinite
Git wisdom) forgot to commit. This includes a change to
Test_window_split_no_room to ensure it doesn't fail for some screen
sizes.
Move Test_smoothscroll_in_zero_width_window to test_scroll_opt.vim, as
that file feels more appropriate.
closes: #14068
Signed-off-by: Sean Dewar <6256228+seandewar@users.noreply.github.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Wed, 21 Feb 2024 19:45:06 +0100 |
parents | 2f1489b02823 |
children | 8c4339d56b1b |
line wrap: on
line diff
--- a/src/testdir/test_window_cmd.vim +++ b/src/testdir/test_window_cmd.vim @@ -322,14 +322,18 @@ func Test_window_split_no_room() call assert_equal(restcmd, winrestcmd()) " Check that the last statusline isn't lost. - set laststatus=0 - let restcmd = winrestcmd() + " Set its window's width to 2 for the test. wincmd j + set laststatus=0 winminwidth=0 + vertical resize 2 + set winminwidth& call setwinvar(winnr('k'), '&statusline', '@#') let last_stl_row = win_screenpos(0)[0] - 1 redraw call assert_equal('@#|', GetScreenStr(last_stl_row)) call assert_equal('~ |', GetScreenStr(&lines - &cmdheight)) + + let restcmd = winrestcmd() call assert_fails('wincmd H', 'E36:') call assert_fails('wincmd L', 'E36:') call assert_equal(layout, winlayout()) @@ -2153,19 +2157,6 @@ func Test_new_help_window_on_error() call assert_equal(expand("<cword>"), "'mod'") endfunc -func Test_smoothscroll_in_zero_width_window() - set cpo+=n number smoothscroll - set winwidth=99999 winminwidth=0 - - vsplit - call assert_equal(0, winwidth(winnr('#'))) - call win_execute(win_getid(winnr('#')), "norm! \<C-Y>") - - only! - set winwidth& winminwidth& - set cpo-=n nonumber nosmoothscroll -endfunc - func Test_splitmove_flatten_frame() split vsplit @@ -2179,7 +2170,7 @@ func Test_splitmove_flatten_frame() only! endfunc -func Test_splitmove_autocmd_window_no_room() +func Test_autocmd_window_force_room() " Open as many windows as possible while v:true try @@ -2206,7 +2197,7 @@ func Test_splitmove_autocmd_window_no_ro edit unload me enew bunload! unload\ me - augroup SplitMoveAucmdWin + augroup AucmdWinForceRoom au! au BufEnter * ++once let s:triggered = v:true \| call assert_equal('autocmd', win_gettype()) @@ -2220,8 +2211,8 @@ func Test_splitmove_autocmd_window_no_ro call assert_equal(winrestcmd(), restcmd) unlet! s:triggered - au! SplitMoveAucmdWin - augroup! SplitMoveAucmdWin + au! AucmdWinForceRoom + augroup! AucmdWinForceRoom %bw! endfunc