comparison src/testdir/test_cmdwin.vim @ 32826:7c4ad06d80ec v9.0.1726

patch 9.0.1726: incorrect heights in win_size_restore() Commit: https://github.com/vim/vim/commit/876f5fb570d8401aa4c58af4a5da91f10520aa9d Author: Sean Dewar <seandewar@users.noreply.github.com> Date: Thu Aug 17 22:40:05 2023 +0200 patch 9.0.1726: incorrect heights in win_size_restore() Problem: incorrect heights in win_size_restore() Solution: avoid restoring incorrect heights in win_size_restore() Changing 'showtabline' or 'cmdheight' in the cmdwin restores incorrect window heights after closing the cmdwin. This may produce a gap between the cmdline and the window above. Solution: restore window sizes only if the number of lines available for windows changed; subtract the rows of the tabline, cmdline and last window's statusline from 'lines' (other statuslines don't matter). closes: #12704 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: Sean Dewar <seandewar@users.noreply.github.com>
author Christian Brabandt <cb@256bit.org>
date Thu, 17 Aug 2023 22:45:06 +0200
parents 695b50472e85
children a522c6c0127b
comparison
equal deleted inserted replaced
32825:2c85a7011b2f 32826:7c4ad06d80ec
438 set encoding=utf8 438 set encoding=utf8
439 let &lines = lines 439 let &lines = lines
440 let &columns = columns 440 let &columns = columns
441 endfunc 441 endfunc
442 442
443 func Test_cmdwin_restore_heights()
444 set showtabline=0 cmdheight=2 laststatus=0
445 call feedkeys("q::set cmdheight=1\<CR>:q\<CR>", 'ntx')
446 call assert_equal(&lines - 1, winheight(0))
447
448 set showtabline=2 cmdheight=3
449 call feedkeys("q::set showtabline=0\<CR>:q\<CR>", 'ntx')
450 call assert_equal(&lines - 3, winheight(0))
451
452 set cmdheight=1 laststatus=2
453 call feedkeys("q::set laststatus=0\<CR>:q\<CR>", 'ntx')
454 call assert_equal(&lines - 1, winheight(0))
455
456 set laststatus=2
457 call feedkeys("q::set laststatus=1\<CR>:q\<CR>", 'ntx')
458 call assert_equal(&lines - 1, winheight(0))
459
460 set laststatus=2
461 belowright vsplit
462 wincmd _
463 let restcmds = winrestcmd()
464 call feedkeys("q::set laststatus=1\<CR>:q\<CR>", 'ntx')
465 " As we have 2 windows, &ls = 1 should still have a statusline on the last
466 " window. As such, the number of available rows hasn't changed and the window
467 " sizes should be restored.
468 call assert_equal(restcmds, winrestcmd())
469
470 set cmdheight& showtabline& laststatus&
471 endfunc
443 472
444 " vim: shiftwidth=2 sts=2 expandtab 473 " vim: shiftwidth=2 sts=2 expandtab