mirror of
https://github.com/neovim/neovim.git
synced 2025-12-16 03:15:39 +00:00
fix(window): prevent win_size_restore from changing cmdheight
Currently it only skips if `Rows` changed, but it's possible for the height of the usable area for windows to change (e.g: via `&ch`, `&stal` or `&ls`), which can cause the value of `&cmdheight` to change when the sizes are restored. This is a Vim bug, so I've submitted a PR there too. No telling when it'll be merged though, given the current lack of activity there. `ROWS_AVAIL` is convenient here, but also subtracts the `global_stl_height()`. Not ideal, as we also care about the height of the last statusline for other values of `&ls`. Meh. Introduce `last_stl_height` for getting the height of the last statusline and use it in `win_size_save/restore` and `last_status` (means `last_status_rec`'s `statusline` argument will now be true if `&ls` is 3, but that does not change the behaviour). Also corrects the logic in `comp_col` to not assume there's a last statusline if `&ls` is 1 and the last window is floating.
This commit is contained in:
@@ -984,14 +984,46 @@ it('tabline is not redrawn in Ex mode #24122', function()
|
||||
end)
|
||||
|
||||
describe("cmdline height", function()
|
||||
before_each(clear)
|
||||
|
||||
it("does not crash resized screen #14263", function()
|
||||
clear()
|
||||
local screen = Screen.new(25, 10)
|
||||
screen:attach()
|
||||
command('set cmdheight=9999')
|
||||
screen:try_resize(25, 5)
|
||||
assert_alive()
|
||||
end)
|
||||
|
||||
it('unchanged when trying to restore window sizes', function()
|
||||
command('set showtabline=0 cmdheight=2 laststatus=0')
|
||||
feed('q:') -- Closing cmdwin tries to restore sizes
|
||||
command('set cmdheight=1 | quit')
|
||||
eq(1, eval('&cmdheight'))
|
||||
|
||||
command('set showtabline=2 cmdheight=3')
|
||||
feed('q:')
|
||||
command('set showtabline=0 | quit')
|
||||
eq(3, eval('&cmdheight'))
|
||||
|
||||
command('set cmdheight=1 laststatus=2')
|
||||
feed('q:')
|
||||
command('set laststatus=0 | quit')
|
||||
eq(1, eval('&cmdheight'))
|
||||
|
||||
command('set laststatus=2')
|
||||
feed('q:')
|
||||
command('set laststatus=1 | quit')
|
||||
eq(1, eval('&cmdheight'))
|
||||
|
||||
command('set laststatus=2 | belowright vsplit | wincmd _')
|
||||
local restcmds = eval('winrestcmd()')
|
||||
feed('q:')
|
||||
command('set laststatus=1 | quit')
|
||||
-- As we have 2 windows, &ls = 1 should still have a statusline on the last
|
||||
-- window. As such, the number of available rows hasn't changed and the window
|
||||
-- sizes should be restored.
|
||||
eq(restcmds, eval('winrestcmd()'))
|
||||
end)
|
||||
end)
|
||||
|
||||
describe('cmdheight=0', function()
|
||||
|
||||
Reference in New Issue
Block a user