mirror of
https://github.com/folke/snacks.nvim
synced 2025-07-10 06:35:09 +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 fullscreen? boolean open in fullscreen
|
||||||
---@field hidden? string[] list of windows that will be excluded from the layout (but can be toggled)
|
---@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? fun(layout: snacks.layout)
|
||||||
|
---@field on_update_pre? fun(layout: snacks.layout)
|
||||||
local defaults = {
|
local defaults = {
|
||||||
layout = {
|
layout = {
|
||||||
width = 0.6,
|
width = 0.6,
|
||||||
|
@ -260,6 +261,11 @@ function M:update()
|
||||||
if self.opts.fullscreen and not self.split then
|
if self.opts.fullscreen and not self.split then
|
||||||
self.root.opts.row = self.root.opts.row + top
|
self.root.opts.row = self.root.opts.row + top
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if self.opts.on_update_pre then
|
||||||
|
self.opts.on_update_pre(self)
|
||||||
|
end
|
||||||
|
|
||||||
for _, win in pairs(self:get_wins()) do
|
for _, win in pairs(self:get_wins()) do
|
||||||
if win:valid() then
|
if win:valid() then
|
||||||
-- update windows with eventignore=all
|
-- update windows with eventignore=all
|
||||||
|
|
|
@ -261,6 +261,9 @@ function M:init_layout(layout)
|
||||||
self.list:update({ force = true })
|
self.list:update({ force = true })
|
||||||
self:update_titles()
|
self:update_titles()
|
||||||
end,
|
end,
|
||||||
|
on_update_pre = function()
|
||||||
|
self:update_titles()
|
||||||
|
end,
|
||||||
layout = {
|
layout = {
|
||||||
backdrop = backdrop,
|
backdrop = backdrop,
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue