File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change 44
55from rich .console import RenderableType
66from rich .highlighter import ReprHighlighter
7+ from rich .measure import measure_renderables
78from rich .pretty import Pretty
89from rich .protocol import is_renderable
910from rich .segment import Segment
@@ -82,15 +83,16 @@ def write(self, content: RenderableType | object) -> None:
8283 renderable = cast (RenderableType , content )
8384
8485 console = self .app .console
85- width = max (
86- self .min_width , self .scrollable_content_region .width or self .min_width
87- )
88-
89- render_options = console .options .update_width (width )
86+ render_options = console .options
9087
9188 if isinstance (renderable , Text ) and not self .wrap :
9289 render_options = render_options .update (overflow = "ignore" , no_wrap = True )
9390
91+ width = max (
92+ self .min_width ,
93+ measure_renderables (console , render_options , [renderable ]).maximum ,
94+ )
95+
9496 segments = self .app .console .render (
9597 renderable , render_options .update_width (width )
9698 )
You can’t perform that action at this time.
0 commit comments