mirror of
https://github.com/neovim/neovim.git
synced 2026-07-13 21:00:42 +00:00
fix(win_close): remove float grid after closing buffer
It is not safe to remove the float grid when autocommands can still be
triggered, as autocommands may use the float grid.
(cherry picked from commit 9a5e80af56)
This commit is contained in:
committed by
github-actions[bot]
parent
e951181d84
commit
d5bdcb2bd7
@@ -8521,6 +8521,34 @@ describe('float window', function()
|
||||
]]}
|
||||
end
|
||||
end)
|
||||
|
||||
describe('no crash after moving and closing float window #21547', function()
|
||||
local function test_float_move_close(cmd)
|
||||
local float_opts = {relative = 'editor', row = 1, col = 1, width = 10, height = 10}
|
||||
meths.open_win(meths.create_buf(false, false), true, float_opts)
|
||||
if multigrid then
|
||||
screen:expect({float_pos = {[4] = {{id = 1001}, 'NW', 1, 1, 1, true}}})
|
||||
end
|
||||
command(cmd)
|
||||
exec_lua([[
|
||||
vim.api.nvim_win_set_config(0, {relative = 'editor', row = 2, col = 2})
|
||||
vim.api.nvim_win_close(0, {})
|
||||
vim.api.nvim_echo({{''}}, false, {})
|
||||
]])
|
||||
if multigrid then
|
||||
screen:expect({float_pos = {}})
|
||||
end
|
||||
assert_alive()
|
||||
end
|
||||
|
||||
it('if WinClosed autocommand flushes UI', function()
|
||||
test_float_move_close('autocmd WinClosed * ++once redraw')
|
||||
end)
|
||||
|
||||
it('if closing buffer flushes UI', function()
|
||||
test_float_move_close('autocmd BufWinLeave * ++once redraw')
|
||||
end)
|
||||
end)
|
||||
end
|
||||
|
||||
describe('with ext_multigrid', function()
|
||||
|
||||
Reference in New Issue
Block a user