diff --git a/src/textual/layouts/stream.py b/src/textual/layouts/stream.py index 49ac14e515..e70b4a253a 100644 --- a/src/textual/layouts/stream.py +++ b/src/textual/layouts/stream.py @@ -85,10 +85,13 @@ def arrange( margin = styles.margin gutter_width, gutter_height = styles.gutter.totals top, right, bottom, left = margin + child_width = width - (left + right) y += top if top > previous_margin else previous_margin previous_margin = bottom height = ( - widget.get_content_height(size, viewport, width - gutter_width) + widget.get_content_height( + size, viewport, max(0, child_width - gutter_width) + ) + gutter_height ) if (max_height := styles.max_height) is not None and max_height.is_cells: @@ -105,7 +108,7 @@ def arrange( ) placements.append( _WidgetPlacement( - _Region(left, y, width - (left + right), height), + _Region(left, y, child_width, height), null_offset, margin, widget,