fix(picker.list): reset preview when no results. Closes #1133

This commit is contained in:
Folke Lemaitre 2025-02-13 11:49:37 +01:00
parent e326de9e0c
commit f8bc1192cb
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040

View file

@ -89,7 +89,6 @@ function M.new(picker)
},
})
self.visible = {}
self.visible_count = 0
self.win = Snacks.win(win_opts)
self.top, self.cursor = 1, 1
self.items = {}
@ -291,6 +290,13 @@ function M:clear()
self.topk:clear()
self.top, self.cursor = 1, 1
self.items = {}
if self._current then
vim.schedule(function()
if self.picker then
self.picker:show_preview()
end
end)
end
self._current = nil
self.dirty = true
if next(self.items) == nil then