tapAt method

void tapAt(
  1. int x,
  2. int y
)

Simulates a full tap (press + release) at raw terminal coordinates.

Events go through Program.send → the full update/render pipeline. The press and release are sent as separate messages with a render pass in between, matching the real-world flow (the terminal delivers press and release as separate escape sequences).

Implementation

void tapAt(int x, int y) {
  _ensureRunning();

  // Press
  _program!.send(
    MouseMsg(action: MouseAction.press, button: MouseButton.left, x: x, y: y),
  );
  // The Program renders after processing the press.  Sync view so hit-test
  // offsets are up-to-date for the release (matches real runtime flow).
  _syncView();

  // Release
  _program!.send(
    MouseMsg(
      action: MouseAction.release,
      button: MouseButton.left,
      x: x,
      y: y,
    ),
  );
  _syncView();
}