mirror of
https://github.com/folke/snacks.nvim
synced 2025-12-23 08:47:57 +00:00
fix(layout): allow width/height to be a function. Closes #2184
This commit is contained in:
parent
82e3b545f3
commit
c757d4dc28
1 changed files with 7 additions and 2 deletions
|
|
@ -324,8 +324,14 @@ function M:update_box(box, parent)
|
|||
end
|
||||
local free = vim.deepcopy(dim)
|
||||
|
||||
local box_win = self.box_wins[box.id]
|
||||
|
||||
local function size(child)
|
||||
return child[size_main] or 0
|
||||
local ret = child[size_main] or 0
|
||||
if type(ret) == "function" then
|
||||
ret = ret(box_win)
|
||||
end
|
||||
return ret
|
||||
end
|
||||
|
||||
local dims = {} ---@type table<number, snacks.win.Dim>
|
||||
|
|
@ -371,7 +377,6 @@ function M:update_box(box, parent)
|
|||
end
|
||||
|
||||
-- update box win
|
||||
local box_win = self.box_wins[box.id]
|
||||
if box_win then
|
||||
if not is_root then
|
||||
box_win.opts.win = self.root.win
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue