@@ -94,8 +94,7 @@ def to_nbformat(self) -> nbformat.NotebookNode:
9494 return nbformat .v4 .new_output (output_type = "stream" , name = self .stream_name , text = self .text )
9595
9696 def compose (self ) -> tp .Iterable [textual .widgets .Widget ]:
97- with textual .containers .HorizontalScroll ():
98- yield textual .widgets .Static (self .ansi_to_rich (self .text ))
97+ yield textual .widgets .Static (self .ansi_to_rich (self .text ))
9998
10099
101100class DisplayData (Output ):
@@ -117,24 +116,23 @@ def _find_image(self):
117116 return None
118117
119118 def compose (self ) -> tp .Iterable [textual .widgets .Widget ]:
120- with textual .containers .HorizontalScroll ():
121- image_key = self ._find_image ()
122- if image_key :
123- image_bytes = (
124- pyvips .Image .svgload_buffer (self .data [image_key ].encode ()).pngsave_buffer ()
125- if image_key == "image/svg+xml"
126- else base64 .b64decode (self .data [image_key ])
127- )
128- image = self .app .image_class (io .BytesIO (image_bytes ))
129- # We'll set the width/height explicitly since automatically setting it seems hard / impossible.
130- cell_size = textual_image .widget .get_cell_size ()
131- image .styles .width = round (image ._image_width / cell_size .width )
132- image .styles .height = round (image ._image_height / cell_size .height )
133- yield image
134- elif self .data .get ("text/markdown" ):
135- yield textual .widgets .Markdown (self .data ["text/markdown" ])
136- elif self .data .get ("text/plain" ):
137- yield textual .widgets .Static (self .ansi_to_rich (self .data ["text/plain" ]))
119+ image_key = self ._find_image ()
120+ if image_key :
121+ image_bytes = (
122+ pyvips .Image .svgload_buffer (self .data [image_key ].encode ()).pngsave_buffer ()
123+ if image_key == "image/svg+xml"
124+ else base64 .b64decode (self .data [image_key ])
125+ )
126+ image = self .app .image_class (io .BytesIO (image_bytes ))
127+ # We'll set the width/height explicitly since automatically setting it seems hard / impossible.
128+ cell_size = textual_image .widget .get_cell_size ()
129+ image .styles .width = round (image ._image_width / cell_size .width )
130+ image .styles .height = round (image ._image_height / cell_size .height )
131+ yield image
132+ elif self .data .get ("text/markdown" ):
133+ yield textual .widgets .Markdown (self .data ["text/markdown" ])
134+ elif self .data .get ("text/plain" ):
135+ yield textual .widgets .Static (self .ansi_to_rich (self .data ["text/plain" ]))
138136
139137
140138class ExecuteResult (DisplayData ):
@@ -165,8 +163,7 @@ def to_nbformat(self) -> nbformat.NotebookNode:
165163 )
166164
167165 def compose (self ) -> tp .Iterable [textual .widgets .Widget ]:
168- with textual .containers .HorizontalScroll ():
169- yield textual .widgets .Static (rich .text .Text .from_ansi ("\n " .join (self .traceback )))
166+ yield textual .widgets .Static (rich .text .Text .from_ansi ("\n " .join (self .traceback )))
170167
171168
172169class Cell (textual .containers .Container , can_focus = True ):
0 commit comments