commit 9e968635efc47eef09588847914190b4b64f008c
parent 4f3aa7bafb75b56acb3d16a7c35a9cb589d86c1e
Author: Tomasz N <przepompownia@users.noreply.github.com>
Date: Fri, 11 Jul 2025 17:31:30 +0200
fix(extui): check if buffers/windows exist before deleting (#34886)
Problem: Disabling vim._extui may try to delete non-existent windows/buffers.
Solution: Check that window/buffer is valid before deleting.
Diffstat:
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/runtime/lua/vim/_extui.lua b/runtime/lua/vim/_extui.lua
@@ -65,10 +65,14 @@ function M.enable(opts)
if ext.cfg.enable == false then
-- Detach and cleanup windows, buffers and autocommands.
for _, win in pairs(ext.wins) do
- api.nvim_win_close(win, true)
+ if api.nvim_win_is_valid(win) then
+ api.nvim_win_close(win, true)
+ end
end
for _, buf in pairs(ext.bufs) do
- api.nvim_buf_delete(buf, {})
+ if api.nvim_buf_is_valid(buf) then
+ api.nvim_buf_delete(buf, {})
+ end
end
api.nvim_clear_autocmds({ group = ext.augroup })
vim.ui_detach(ext.ns)