Skip to content

Commit 4077fc6

Browse files
authored
fix(renderer): clean closed windows from floating_windows array (#760)
1 parent 93491a0 commit 4077fc6

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

lua/neo-tree/ui/renderer.lua

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,19 @@ local log = require("neo-tree.log")
1414
local M = { resize_timer_interval = 50 }
1515
local ESC_KEY = vim.api.nvim_replace_termcodes("<ESC>", true, false, true)
1616
local default_popup_size = { width = 60, height = "80%" }
17-
local floating_windows = {}
1817
local draw, create_window, create_tree, render_tree
1918

19+
local floating_windows = {}
20+
local update_floating_windows = function()
21+
local valid_windows = {}
22+
for _, win in ipairs(floating_windows) do
23+
if M.is_window_valid(win.winid) then
24+
table.insert(valid_windows, win)
25+
end
26+
end
27+
floating_windows = valid_windows
28+
end
29+
2030
-- clean up neotree buffers created by :mksession
2131
local cleaned_up = false
2232
local clean_neotree_buffers = function()
@@ -926,6 +936,7 @@ create_window = function(state)
926936
end
927937

928938
M.update_floating_window_layouts = function()
939+
update_floating_windows()
929940
for _, win in ipairs(floating_windows) do
930941
local opt = {
931942
relative = "win",

0 commit comments

Comments
 (0)