Skip to content

fix(mobile): Android terminal keystrokes paint immediately - #30

Closed
macodev00 wants to merge 1 commit into
mainfrom
cursor/android-terminal-echo-reconcile-b7a5
Closed

macodev00 wants to merge 1 commit into
mainfrom
cursor/android-terminal-echo-reconcile-b7a5

Conversation

@macodev00

Copy link
Copy Markdown
Owner

What Changed

Android terminal keystrokes now paint in the native surface before the remote pty echoes them. Printable input is fed to Ghostty immediately, then reconciled with the authoritative pty byte stream so a matching echo is drawn once. If the pty does not echo those bytes, the grid is rebuilt from the pty buffer and local echo stays off until a later keystroke is echoed verbatim.

Trusted prediction stops at the same pending-input cap as the untrusted probe, and further keystrokes fall back to remote echo. Password, passphrase, passcode, and PIN prompts, including ones with a URL or a parenthetical, are left for the pty. A control key holds local echo until the pty answers, and a rebuild does not resend device replies for history the previous session already answered.

This supersedes pingdotgg#13233 (Macroscope not approved) and pingdotgg#13226. The three blocking findings from pingdotgg#13233 are baked in:

  1. Secret-prompt detection inspects the current line after the last newline or carriage return, then strips ANSI. It does not takeLast(240) first, so a long Password for 'https://…': line cannot drop the leading Password token while keeping the trailing colon.
  2. Trusted keys refused at the pending-input cap stay in pendingInput. Painting stays off until those bytes are echoed, so a partial echo cannot paint the next key and later reset the grid.
  3. awaitingRemote stays set while a new snapshot is only the outstanding printable echo (for example ls after ls + Enter). It clears once CR/LF or other control processing is visible.

Fixes pingdotgg#12756

Supersedes pingdotgg#13233 and pingdotgg#13226

Why

Characters were drawn only after a full attach round trip. On a phone that delay is visible on every key. pingdotgg#13226 was not approved because a trusted session could grow the predicted buffer without limit, and the prompt check missed Passcode: and PIN:. pingdotgg#13233 fixed those, then Macroscope rejected long-prompt detection, cap overflow after a partial echo, and clearing awaitingRemote on a printable-only suffix.

UI Changes

This changes when typed characters appear in the Android terminal. Layout is unchanged. This environment has no Android emulator (/dev/kvm is unavailable) and no device, so there is no before/after recording. Reconciliation is covered by TerminalLocalEchoTest.

iOS still paints from the remote buffer. This report is the Android client.

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes
  • I included a video for animation/interaction changes

Screenshots do not show the latency. A recording needs a device build of the native terminal module.

Open in Web Open in Cursor 

@github-actions github-actions Bot added size:XL vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. labels Sep 23, 2026
Printable keys were drawn only after a remote pty round trip, so typing
on Android felt late on every character. Paint those keys before the pty
echoes them, stop once the prediction cap is reached, and leave password,
passcode, and PIN prompts on the remote path.

Long secret prompts are matched on the current line so a leading Password
token cannot be dropped. Keys refused at the pending-input cap stay in
pendingInput until they are echoed. A control key keeps holding local
echo while the pty only repeats earlier printable bytes.
@cursor
cursor Bot force-pushed the cursor/android-terminal-echo-reconcile-b7a5 branch from 44d2d4c to c86801f Compare September 23, 2026 08:46
@macodev00

Copy link
Copy Markdown
Owner Author

Superseded by upstream READY PR on pingdotgg/t3code (same branch).

@macodev00 macodev00 closed this Sep 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XL vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Android: terminal typing echo is abnormally slow (per-keystroke delay)

1 participant