@@ -75,7 +75,7 @@ def render_segments(self, console: Console) -> str:
7575class LayoutUpdate (CompositorUpdate ):
7676 """A renderable containing the result of a render for a given region."""
7777
78- def __init__ (self , strips : list [Strip ], region : Region ) -> None :
78+ def __init__ (self , strips : list [Iterable [ Strip ] ], region : Region ) -> None :
7979 self .strips = strips
8080 self .region = region
8181
@@ -87,7 +87,8 @@ def __rich_console__(
8787 move_to = Control .move_to
8888 for last , (y , line ) in loop_last (enumerate (self .strips , self .region .y )):
8989 yield move_to (x , y ).segment
90- yield from line
90+ for strip in line :
91+ yield from strip
9192 if not last :
9293 yield new_line
9394
@@ -102,11 +103,12 @@ def render_segments(self, console: Console) -> str:
102103 """
103104 sequences : list [str ] = []
104105 append = sequences .append
106+ extend = sequences .extend
105107 x = self .region .x
106108 move_to = Control .move_to
107109 for last , (y , line ) in loop_last (enumerate (self .strips , self .region .y )):
108110 append (move_to (x , y ).segment .text )
109- append ( line .render (console ))
111+ extend ([ strip .render (console ) for strip in line ] )
110112 if not last :
111113 append ("\n " )
112114 return "" .join (sequences )
@@ -239,7 +241,6 @@ def render_segments(self, console: Console) -> str:
239241 Returns:
240242 Raw data with escape sequences.
241243 """
242-
243244 sequences : list [str ] = []
244245 append = sequences .append
245246
@@ -613,8 +614,9 @@ def add_widget(
613614 - widget .scrollbar_size_horizontal
614615 )
615616 )
616- widget .set_reactive (Widget .scroll_y , new_scroll_y )
617- widget .set_reactive (Widget .scroll_target_y , new_scroll_y )
617+ capped_scroll_y = widget .validate_scroll_y (new_scroll_y )
618+ widget .set_reactive (Widget .scroll_y , capped_scroll_y )
619+ widget .set_reactive (Widget .scroll_target_y , capped_scroll_y )
618620 widget .vertical_scrollbar ._reactive_position = new_scroll_y
619621
620622 if visible_only :
@@ -1132,14 +1134,15 @@ def render_full_update(self, simplify: bool = False) -> LayoutUpdate:
11321134 self ._dirty_regions .clear ()
11331135 crop = screen_region
11341136 chops = self ._render_chops (crop , lambda y : True )
1137+ render_strips : list [Iterable [Strip ]]
11351138 if simplify :
11361139 # Simplify is done when exporting to SVG
11371140 # It doesn't make things faster
11381141 render_strips = [
1139- Strip .join (chop .values ()).simplify ().discard_meta () for chop in chops
1142+ [ Strip .join (chop .values ()).simplify ().discard_meta ()] for chop in chops
11401143 ]
11411144 else :
1142- render_strips = [Strip . join ( chop .values () ) for chop in chops ]
1145+ render_strips = [chop .values () for chop in chops ]
11431146
11441147 return LayoutUpdate (render_strips , screen_region )
11451148
@@ -1182,7 +1185,7 @@ def _render_chops(
11821185 self ,
11831186 crop : Region ,
11841187 is_rendered_line : Callable [[int ], bool ],
1185- ) -> Sequence [Mapping [int , Strip | None ]]:
1188+ ) -> Sequence [Mapping [int , Strip ]]:
11861189 """Render update 'chops'.
11871190
11881191 Args:
@@ -1221,8 +1224,7 @@ def _render_chops(
12211224 for cut , strip in zip (final_cuts , cut_strips ):
12221225 if get_chops_line (cut ) is None :
12231226 chops_line [cut ] = strip
1224-
1225- return chops
1227+ return cast ("Sequence[Mapping[int, Strip]]" , chops )
12261228
12271229 def __rich__ (self ) -> StripRenderable :
12281230 return StripRenderable (self .render_strips ())
0 commit comments