diff --git a/elements/basic/container.go b/elements/basic/container.go index 158170d..1e4e785 100644 --- a/elements/basic/container.go +++ b/elements/basic/container.go @@ -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) } diff --git a/layouts/vertical.go b/layouts/vertical.go index 1eb544c..84c05fd 100644 --- a/layouts/vertical.go +++ b/layouts/vertical.go @@ -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