Skip to content

Commit 03b9470

Browse files
committed
fix error with selection when widget removed
1 parent 0afd264 commit 03b9470

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

src/textual/screen.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1663,12 +1663,15 @@ def _watch__select_end(
16631663
if end_region.y <= start_region.bottom or self._box_select:
16641664
select_regions.append(Region.union(start_region, end_region))
16651665
else:
1666-
container_region = Region.from_union(
1667-
[
1668-
start_widget.select_container.content_region,
1669-
end_widget.select_container.content_region,
1670-
]
1671-
)
1666+
try:
1667+
container_region = Region.from_union(
1668+
[
1669+
start_widget.select_container.content_region,
1670+
end_widget.select_container.content_region,
1671+
]
1672+
)
1673+
except NoMatches:
1674+
return
16721675

16731676
start_region = Region.from_corners(
16741677
start_region.x,

src/textual/widget.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1756,7 +1756,6 @@ def validate_scroll_target_x(self, value: float) -> float:
17561756
return round(clamp(value, 0, self.max_scroll_x))
17571757

17581758
def validate_scroll_y(self, value: float) -> float:
1759-
# return value
17601759
return clamp(value, 0, self.max_scroll_y)
17611760

17621761
def validate_scroll_target_y(self, value: float) -> float:

0 commit comments

Comments
 (0)