fix(picker): update titles before showing. Closes #1337

This commit is contained in:
Folke Lemaitre 2025-02-20 16:06:19 +01:00
parent a4e2c3e4fc
commit 3ae98636aa
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040
2 changed files with 9 additions and 0 deletions

View file

@ -32,6 +32,7 @@ M.meta = {
---@field fullscreen? boolean open in fullscreen
---@field hidden? string[] list of windows that will be excluded from the layout (but can be toggled)
---@field on_update? fun(layout: snacks.layout)
---@field on_update_pre? fun(layout: snacks.layout)
local defaults = {
layout = {
width = 0.6,
@ -260,6 +261,11 @@ function M:update()
if self.opts.fullscreen and not self.split then
self.root.opts.row = self.root.opts.row + top
end
if self.opts.on_update_pre then
self.opts.on_update_pre(self)
end
for _, win in pairs(self:get_wins()) do
if win:valid() then
-- update windows with eventignore=all

View file

@ -261,6 +261,9 @@ function M:init_layout(layout)
self.list:update({ force = true })
self:update_titles()
end,
on_update_pre = function()
self:update_titles()
end,
layout = {
backdrop = backdrop,
},