mirror of
https://github.com/folke/snacks.nvim
synced 2025-07-07 21:25:11 +00:00
fix(picker): update titles before showing. Closes #1337
This commit is contained in:
parent
a4e2c3e4fc
commit
3ae98636aa
2 changed files with 9 additions and 0 deletions
|
@ -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
|
||||
|
|
|
@ -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,
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue