fix(picker): don't render list when closed. See #1308

This commit is contained in:
Folke Lemaitre 2025-02-20 08:47:58 +01:00
parent 7769d7e2df
commit 681ae6e307
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040
2 changed files with 6 additions and 3 deletions

View file

@ -12,6 +12,9 @@ local M = {}
---@param picker snacks.Picker
---@param path string
function M.reveal(picker, path)
if picker.closed then
return
end
for item, idx in picker:iter() do
if item.file == path then
picker.list:view(idx)

View file

@ -366,9 +366,6 @@ function M:update(opts)
if self.paused and #self.items < self.state.height then
return
end
if not self.win:valid() then
return
end
self:render()
end
@ -553,6 +550,9 @@ function M:update_cursorline()
end
function M:render()
if not self.win:valid() then
return
end
stats.render = stats.render + 1
if self.target then
self:view(self.target.cursor, self.target.top, false)