@@ -423,9 +423,7 @@ def reflow_visible(self, parent: Widget, size: Size) -> set[Widget]:
423423 self .size = size
424424
425425 # Keep a copy of the old map because we're going to compare it with the update
426- old_map = (
427- self ._visible_map if self ._visible_map is not None else self ._full_map or {}
428- )
426+ old_map = self ._visible_map or {}
429427 map , widgets = self ._arrange_root (parent , size , visible_only = True )
430428
431429 # Replace map and widgets
@@ -877,16 +875,14 @@ def cuts(self) -> list[list[int]]:
877875 return self ._cuts
878876
879877 width , height = self .size
880- screen_region = self .size .region
881878 cuts = [[0 , width ] for _ in range (height )]
882879
883880 intersection = Region .intersection
884881 extend = list .extend
885882
886883 for region , clip in self .visible_widgets .values ():
887- region = intersection (region , clip )
888- if region and (region in screen_region ):
889- x , y , region_width , region_height = region
884+ x , y , region_width , region_height = intersection (region , clip )
885+ if region_width and region_height :
890886 region_cuts = (x , x + region_width )
891887 for cut in cuts [y : y + region_height ]:
892888 extend (cut , region_cuts )
@@ -937,15 +933,13 @@ def _get_renders(
937933 _Region (0 , 0 , region .width , region .height )
938934 )
939935 else :
940- clipped_region = intersection (region , clip )
941- if not clipped_region :
942- continue
943- new_x , new_y , new_width , new_height = clipped_region
944- delta_x = new_x - region .x
945- delta_y = new_y - region .y
946- yield region , clip , widget .render_lines (
947- _Region (delta_x , delta_y , new_width , new_height )
948- )
936+ new_x , new_y , new_width , new_height = intersection (region , clip )
937+ if new_width and new_height :
938+ yield region , clip , widget .render_lines (
939+ _Region (
940+ new_x - region .x , new_y - region .y , new_width , new_height
941+ )
942+ )
949943
950944 def render_update (
951945 self , full : bool = False , screen_stack : list [Screen ] | None = None
0 commit comments