Progress?

This commit is contained in:
Sasha Koshka 2023-01-17 10:55:38 -05:00
parent 40bdffc8be
commit 7398f146ba
2 changed files with 6 additions and 3 deletions

View File

@ -300,7 +300,6 @@ func (element *Container) HandleSelection (direction tomo.SelectionDirection) (o
return false
}
// FIXME: fix this!
func (element *Container) MinimumHeightFor (width int) (height int) {
return element.layout.MinimumHeightFor(element.children, width)
}

View File

@ -106,14 +106,18 @@ func (layout Vertical) MinimumSize (
// specified elements at the given width, taking into account flexible elements.
func (layout Vertical) MinimumHeightFor (
entries []tomo.LayoutEntry,
squeeze int,
width int,
) (
height int,
) {
if layout.Pad {
width -= theme.Padding() * 2
}
for index, entry := range entries {
child, flexible := entry.Element.(tomo.Flexible)
if flexible {
height += child.MinimumHeightFor(squeeze)
height += child.MinimumHeightFor(width)
} else {
_, entryHeight := entry.MinimumSize()
height += entryHeight