Skip to content

Commit 4e0f6f1

Browse files
committed
implicit pause
1 parent b3e1ef9 commit 4e0f6f1

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/textual/message_pump.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -468,8 +468,10 @@ async def wait_for_refresh(self) -> bool:
468468
due to calling it within the node's own task.
469469
470470
"""
471-
472-
if self._task is None or asyncio.current_task() is self._task:
471+
assert (
472+
self._task is not None
473+
), "Node must be running before calling wait_for_refresh"
474+
if asyncio.current_task() is self._task:
473475
return False
474476
refreshed_event = asyncio.Event()
475477
self.call_after_refresh(refreshed_event.set)

src/textual/pilot.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,7 @@ async def _post_mouse_events(
434434
widget_at = None
435435
for chain in range(1, times + 1):
436436
for mouse_event_cls in events:
437+
await self.pause()
437438
# Get the widget under the mouse before the event because the app might
438439
# react to the event and move things around. We override on each iteration
439440
# because we assume the final event in `events` is the actual event we care
@@ -453,8 +454,8 @@ async def _post_mouse_events(
453454
# we patch the offset in there as well.
454455
app.mouse_position = offset
455456
screen._forward_event(event)
456-
await self.pause()
457457

458+
await self.pause()
458459
return widget is None or widget_at is target_widget
459460

460461
async def _wait_for_screen(self, timeout: float = 30.0) -> bool:

0 commit comments

Comments
 (0)