1010 from textual .widget import Widget
1111
1212
13+ from textual ._profile import timer
14+
15+
1316class StreamLayout (Layout ):
1417 """A cut down version of the vertical layout.
1518
@@ -31,9 +34,11 @@ class StreamLayout(Layout):
3134
3235 name = "stream"
3336
37+ @timer ("arrange STREAM" )
3438 def arrange (
3539 self , parent : Widget , children : list [Widget ], size : Size , greedy : bool = True
3640 ) -> ArrangeResult :
41+ print (parent )
3742 parent .pre_layout (self )
3843 if not children :
3944 return []
@@ -81,3 +86,39 @@ def arrange(
8186 y += height
8287
8388 return placements
89+
90+ @timer ("STREAM.get_content_width" )
91+ def get_content_width (self , widget : Widget , container : Size , viewport : Size ) -> int :
92+ """Get the optimal content width by arranging children.
93+
94+ Args:
95+ widget: The container widget.
96+ container: The container size.
97+ viewport: The viewport size.
98+
99+ Returns:
100+ Width of the content.
101+ """
102+ return widget .scrollable_content_region .width
103+
104+ @timer ("STREAM.get_content_height" )
105+ def get_content_height (
106+ self , widget : Widget , container : Size , viewport : Size , width : int
107+ ) -> int :
108+ """Get the content height.
109+
110+ Args:
111+ widget: The container widget.
112+ container: The container size.
113+ viewport: The viewport.
114+ width: The content width.
115+
116+ Returns:
117+ Content height (in lines).
118+ """
119+ if widget ._nodes :
120+ arrangement = widget ._arrange (Size (width , 0 ))
121+ height = arrangement .total_region .height
122+ else :
123+ height = 0
124+ return height
0 commit comments