Skip to content

Commit 7a08898

Browse files
committed
fix: winfixbuf/current toggle bug from #1390
1 parent 6011391 commit 7a08898

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

lua/neo-tree/ui/renderer.lua

+8-5
Original file line numberDiff line numberDiff line change
@@ -164,12 +164,15 @@ M.close = function(state, focus_prior_window)
164164
state.winid = nil
165165
end
166166
local bufnr = utils.get_value(state, "bufnr", 0, true)
167-
state.bufnr = nil
168-
vim.schedule(function()
169-
if bufnr > 0 and vim.api.nvim_buf_is_valid(bufnr) then
170-
vim.api.nvim_buf_delete(bufnr, { force = true })
167+
if bufnr > 0 and vim.api.nvim_buf_is_valid(bufnr) then
168+
state.bufnr = nil
169+
local success, err = pcall(vim.api.nvim_buf_delete, bufnr, { force = true })
170+
if not success and err:match("E523") then
171+
vim.schedule_wrap(function()
172+
vim.api.nvim_buf_delete(bufnr, { force = true })
173+
end)()
171174
end
172-
end)
175+
end
173176
return window_existed
174177
end
175178

0 commit comments

Comments
 (0)