mirror of
https://github.com/neovim/neovim.git
synced 2025-10-09 11:26:37 +00:00
fix(api): nvim_open_win default to half-size for splits (#36088)
Problem: after #35601, nvim_open_win incorrectly attempts to set the size of a split window to 0 if it wasn't specified. Solution: only attempt to set the size again if it was actually specified. This has the effect of defaulting to half the size of the parent window (or it may be equalized with other windows to make room), like before. Fix #36080
This commit is contained in:
@@ -2273,6 +2273,16 @@ describe('API/win', function()
|
||||
command('split')
|
||||
win = api.nvim_open_win(0, false, { win = 0, split = 'below', height = 10 })
|
||||
eq(10, api.nvim_win_get_height(win))
|
||||
|
||||
-- Still defaults to half-sized when no size was specified.
|
||||
command('only')
|
||||
eq(80, api.nvim_win_get_width(0))
|
||||
api.nvim_open_win(0, true, { split = 'right' })
|
||||
eq(40, api.nvim_win_get_width(0))
|
||||
|
||||
eq(22, api.nvim_win_get_height(0))
|
||||
api.nvim_open_win(0, true, { split = 'below' })
|
||||
eq(11, api.nvim_win_get_height(0))
|
||||
end)
|
||||
end)
|
||||
|
||||
|
Reference in New Issue
Block a user