fix(picker): don't destroy active pickers (only an issue when multiple pickers were open)

This commit is contained in:
Folke Lemaitre 2025-01-30 10:41:15 +01:00
parent b37f368a81
commit b479f10b24

View file

@ -70,14 +70,16 @@ function M.new(opts)
end,
})
local picker_count = vim.tbl_count(M._pickers)
local picker_count = vim.tbl_count(M._pickers) - vim.tbl_count(M._active)
if picker_count > 0 then
-- clear items from previous pickers for garbage collection
for picker, _ in pairs(M._pickers) do
picker.finder.items = {}
picker.list.items = {}
picker.list:clear()
picker.list.picker = nil
if not M._active[picker] then
picker.finder.items = {}
picker.list.items = {}
picker.list:clear()
picker.list.picker = nil
end
end
end