mirror of
https://github.com/folke/snacks.nvim
synced 2025-08-04 18:58:12 +00:00
fix(win): always close created scratch buffers when win closes
This commit is contained in:
parent
715104d180
commit
abd7e61b73
1 changed files with 6 additions and 0 deletions
|
@ -493,11 +493,14 @@ function M:close(opts)
|
|||
|
||||
local win = self.win
|
||||
local buf = wipe and self.buf
|
||||
local scratch_buf = self.scratch_buf ~= self.buf and self.scratch_buf or nil
|
||||
|
||||
self.win = nil
|
||||
self.scratch_buf = nil
|
||||
if buf then
|
||||
self.buf = nil
|
||||
end
|
||||
|
||||
local close = function()
|
||||
if win and vim.api.nvim_win_is_valid(win) then
|
||||
vim.api.nvim_win_close(win, true)
|
||||
|
@ -505,6 +508,9 @@ function M:close(opts)
|
|||
if buf and vim.api.nvim_buf_is_valid(buf) then
|
||||
vim.api.nvim_buf_delete(buf, { force = true })
|
||||
end
|
||||
if scratch_buf and vim.api.nvim_buf_is_valid(scratch_buf) then
|
||||
vim.api.nvim_buf_delete(scratch_buf, { force = true })
|
||||
end
|
||||
if self.augroup then
|
||||
pcall(vim.api.nvim_del_augroup_by_id, self.augroup)
|
||||
self.augroup = nil
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue