mirror of
https://github.com/folke/snacks.nvim
synced 2025-08-04 18:58:12 +00:00
fix(picker): don't destroy active pickers (only an issue when multiple pickers were open)
This commit is contained in:
parent
b37f368a81
commit
b479f10b24
1 changed files with 7 additions and 5 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue