mirror of
https://github.com/neovim/neovim
synced 2025-07-15 16:51:49 +00:00
fix(window): don't store invalid height in window config (#34885)
Problem: When 'winminheight' is zero and the window height is set to zero, the actual height is clamped whereas the stored config value is not. Reciprocal window configuration through nvim_win_get_config() then results in an error. Solution: Also clamp the stored dimensions in the window config.
This commit is contained in:
@ -724,8 +724,8 @@ void ui_grid_resize(handle_T grid_handle, int width, int height, Error *err)
|
||||
|
||||
if (wp->w_floating) {
|
||||
if (width != wp->w_width || height != wp->w_height) {
|
||||
wp->w_config.width = width;
|
||||
wp->w_config.height = height;
|
||||
wp->w_config.width = MAX(width, 1);
|
||||
wp->w_config.height = MAX(height, 1);
|
||||
win_config_float(wp, wp->w_config);
|
||||
}
|
||||
} else {
|
||||
|
@ -5854,7 +5854,7 @@ void win_setheight_win(int height, win_T *win)
|
||||
height = MAX(height, (int)(win == curwin ? MAX(p_wmh, 1) : p_wmh) + win->w_winbar_height);
|
||||
|
||||
if (win->w_floating) {
|
||||
win->w_config.height = height;
|
||||
win->w_config.height = MAX(height, 1);
|
||||
win_config_float(win, win->w_config);
|
||||
redraw_later(win, UPD_VALID);
|
||||
} else {
|
||||
|
@ -923,6 +923,13 @@ describe('float window', function()
|
||||
assert_alive()
|
||||
end)
|
||||
|
||||
it("no error for zero height with 'winminheight'", function()
|
||||
local win = api.nvim_open_win(0, false, { relative = 'editor', row = 0, col = 0, height = 1, width = 1 })
|
||||
api.nvim_set_option_value('winminheight', 0, {})
|
||||
api.nvim_win_set_height(win, 0)
|
||||
api.nvim_win_set_config(win, api.nvim_win_get_config(win))
|
||||
end)
|
||||
|
||||
local function with_ext_multigrid(multigrid)
|
||||
local screen, attrs
|
||||
before_each(function()
|
||||
|
Reference in New Issue
Block a user