mirror of
https://github.com/neovim/neovim.git
synced 2026-02-19 01:48:30 +00:00
fix(pack): explicitly close confirmation window #37861
Problem: Executing `nvim_buf_delete()` does not guarantee that the window which shows the buffer is going to close after `:write` or `:quit`. In particular, if there is no listed buffer present. Solution: Explicitly close the window that was created for confirmation buffer. Use `pcall` to catch cases when the window was already closed or when it is the last window.
This commit is contained in:
committed by
GitHub
parent
cadddbff69
commit
539b8027a3
@@ -1122,6 +1122,7 @@ local function show_confirm_buf(lines, on_finish)
|
||||
local win_id = api.nvim_get_current_win()
|
||||
|
||||
local delete_buffer = vim.schedule_wrap(function()
|
||||
pcall(api.nvim_win_close, win_id, true)
|
||||
pcall(api.nvim_buf_delete, bufnr, { force = true })
|
||||
vim.cmd.redraw()
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user