mirror of
https://github.com/neovim/neovim.git
synced 2025-10-05 09:26:30 +00:00
fix(floatwin): don't always use winheight
This commit is contained in:
@@ -4608,11 +4608,12 @@ static void win_enter_ext(win_T *wp, bool undo_sync, int curwin_invalid,
|
|||||||
redraw_all_later(NOT_VALID);
|
redraw_all_later(NOT_VALID);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* set window height to desired minimal value */
|
// set window height to desired minimal value
|
||||||
if (curwin->w_height < p_wh && !curwin->w_p_wfh)
|
if (curwin->w_height < p_wh && !curwin->w_p_wfh && !curwin->w_floating) {
|
||||||
win_setheight((int)p_wh);
|
win_setheight((int)p_wh);
|
||||||
else if (curwin->w_height == 0)
|
} else if (curwin->w_height == 0) {
|
||||||
win_setheight(1);
|
win_setheight(1);
|
||||||
|
}
|
||||||
|
|
||||||
// set window width to desired minimal value
|
// set window width to desired minimal value
|
||||||
if (curwin->w_width < p_wiw && !curwin->w_p_wfw && !wp->w_floating) {
|
if (curwin->w_width < p_wiw && !curwin->w_p_wfw && !wp->w_floating) {
|
||||||
|
@@ -83,6 +83,50 @@ describe('floatwin', function()
|
|||||||
assert_alive()
|
assert_alive()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
it('opened with correct height', function()
|
||||||
|
local height = exec_lua([[
|
||||||
|
vim.api.nvim_set_option("winheight", 20)
|
||||||
|
local bufnr = vim.api.nvim_create_buf(false, true)
|
||||||
|
|
||||||
|
local opts = {
|
||||||
|
height = 10,
|
||||||
|
col = 5,
|
||||||
|
row = 1,
|
||||||
|
relative = 'editor',
|
||||||
|
style = 'minimal',
|
||||||
|
width = 15
|
||||||
|
}
|
||||||
|
|
||||||
|
local win_id = vim.api.nvim_open_win(bufnr, true, opts)
|
||||||
|
|
||||||
|
return vim.api.nvim_win_get_height(win_id)
|
||||||
|
]])
|
||||||
|
|
||||||
|
eq(10, height)
|
||||||
|
end)
|
||||||
|
|
||||||
|
it('opened with correct width', function()
|
||||||
|
local width = exec_lua([[
|
||||||
|
vim.api.nvim_set_option("winwidth", 20)
|
||||||
|
local bufnr = vim.api.nvim_create_buf(false, true)
|
||||||
|
|
||||||
|
local opts = {
|
||||||
|
height = 10,
|
||||||
|
col = 5,
|
||||||
|
row = 1,
|
||||||
|
relative = 'editor',
|
||||||
|
style = 'minimal',
|
||||||
|
width = 10
|
||||||
|
}
|
||||||
|
|
||||||
|
local win_id = vim.api.nvim_open_win(bufnr, true, opts)
|
||||||
|
|
||||||
|
return vim.api.nvim_win_get_width(win_id)
|
||||||
|
]])
|
||||||
|
|
||||||
|
eq(10, width)
|
||||||
|
end)
|
||||||
|
|
||||||
local function with_ext_multigrid(multigrid)
|
local function with_ext_multigrid(multigrid)
|
||||||
local screen
|
local screen
|
||||||
before_each(function()
|
before_each(function()
|
||||||
|
Reference in New Issue
Block a user