mirror of
https://github.com/folke/snacks.nvim
synced 2025-08-06 11:48:23 +00:00
perf(picker): small optims
This commit is contained in:
parent
0396bdfc3e
commit
ee76e9ba67
1 changed files with 6 additions and 8 deletions
|
@ -469,14 +469,6 @@ function M:close()
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
-- FIXME: lsp definitions picker can't be gc-ed without the below,
|
|
||||||
-- which makes no sense. Need to further investigate.
|
|
||||||
|
|
||||||
-- if not self.shown then
|
|
||||||
-- self.input.win.opts.relative = "editor"
|
|
||||||
-- self.input.win:show()
|
|
||||||
-- end
|
|
||||||
|
|
||||||
self:hist_record(true)
|
self:hist_record(true)
|
||||||
self.closed = true
|
self.closed = true
|
||||||
M.last.selected = self:selected({ fallback = false })
|
M.last.selected = self:selected({ fallback = false })
|
||||||
|
@ -491,6 +483,9 @@ function M:close()
|
||||||
vim.api.nvim_set_current_win(self.main)
|
vim.api.nvim_set_current_win(self.main)
|
||||||
end
|
end
|
||||||
self.updater:stop()
|
self.updater:stop()
|
||||||
|
if not self.updater:is_closing() then
|
||||||
|
self.updater:close()
|
||||||
|
end
|
||||||
self.finder:abort()
|
self.finder:abort()
|
||||||
self.matcher:abort()
|
self.matcher:abort()
|
||||||
M._active[self] = nil
|
M._active[self] = nil
|
||||||
|
@ -638,6 +633,9 @@ end
|
||||||
--- based on the current pattern and search string.
|
--- based on the current pattern and search string.
|
||||||
---@param opts? { on_done?: fun(), refresh?: boolean }
|
---@param opts? { on_done?: fun(), refresh?: boolean }
|
||||||
function M:find(opts)
|
function M:find(opts)
|
||||||
|
if self.closed then
|
||||||
|
return
|
||||||
|
end
|
||||||
opts = opts or {}
|
opts = opts or {}
|
||||||
local filter = self.input.filter:clone({ trim = true })
|
local filter = self.input.filter:clone({ trim = true })
|
||||||
local refresh = opts.refresh ~= false
|
local refresh = opts.refresh ~= false
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue