Skip to content

Commit

Permalink
test fix
Browse files Browse the repository at this point in the history
  • Loading branch information
willmcgugan committed Jan 3, 2025
1 parent 568152a commit 49d2a85
Showing 1 changed file with 17 additions and 18 deletions.
35 changes: 17 additions & 18 deletions src/textual/screen.py
Original file line number Diff line number Diff line change
Expand Up @@ -1481,23 +1481,6 @@ def _forward_event(self, event: events.Event) -> None:
if isinstance(event, (events.Enter, events.Leave)):
self.post_message(event)

if isinstance(event, events.MouseDown):
self._mouse_down_offset = event.screen_offset
select_widget, select_offset = self.get_widget_and_offset_at(
event.screen_x, event.screen_y
)
if select_widget is not None and select_widget.allow_select:
self._selecting = True
if select_widget is not None and select_offset is not None:
self._select_start = (
select_widget,
event.screen_offset,
select_offset,
)

else:
self._selecting = False

elif isinstance(event, events.MouseUp):
if (
self._mouse_down_offset is not None
Expand All @@ -1522,7 +1505,23 @@ def _forward_event(self, event: events.Event) -> None:
):
self._select_end = (select_widget, event.offset, select_offset)

if isinstance(event, events.MouseEvent):
elif isinstance(event, events.MouseEvent):
if isinstance(event, events.MouseDown) and not self.app.mouse_captured:
self._mouse_down_offset = event.screen_offset
select_widget, select_offset = self.get_widget_and_offset_at(
event.screen_x, event.screen_y
)
if select_widget is not None and select_widget.allow_select:
self._selecting = True
if select_widget is not None and select_offset is not None:
self._select_start = (
select_widget,
event.screen_offset,
select_offset,
)
else:
self._selecting = False

try:
if self.app.mouse_captured:
widget = self.app.mouse_captured
Expand Down

0 comments on commit 49d2a85

Please sign in to comment.