Files
orca/mobile/src
Brennan Benson 75719bd38b fix(terminal): keep the mouse report format in desktop pane snapshots so phone swipes never type escape text (#23943)
* fix(mobile): preserve host mouse modes for terminal scrolling

* revert(terminal): drop the out-of-band mouse-modes channel

The earlier commit sent the host's mouse tracking and encoding beside
each snapshot and stream frame, and made the phone trust that over what
its replayed bytes say. Where the snapshot text already carries the
encoding this is redundant, and where the text is wrong (a desktop pane
snapshot never writes ?1006h) the host's own mirror is seeded from that
same text, so the side channel asserts the wrong encoding too.

Remove the shared type, the host publication, the wire fields and the
phone's host-modes authority. The phone keeps its guard: while mouse
tracking is on but no replayed byte proved the encoding, a wheel scrolls
locally instead of sending a guessed legacy report.

* fix(terminal): carry the mouse encoding in desktop pane snapshots

Swiping a phone terminal running Codex typed `[M`-style mouse bytes into
Codex's prompt instead of scrolling (#23818). Codex turns on mouse
tracking with the SGR encoding (?1006h). A desktop pane snapshot is made
by xterm's serialize addon, which writes the tracking modes but never the
encoding, so the phone replayed "tracking on, legacy encoding" and sent
legacy `ESC[M` reports that Codex does not parse. The host's own terminal
model is seeded from the same snapshot, so it lost the encoding too.

The pane now mirrors its xterm's mouse encoding from the parser (1006,
1016 and a full reset, with xterm's own set/reset rules) and its snapshot
ends with the matching DECSET, after the alternate-screen switch that
readers keep. Programs on the default encoding get nothing appended.

The phone keeps a guard for hosts without this fix: while a wheel-
reporting tracking mode is on but no replayed byte proved the encoding,
a wheel or swipe scrolls locally and a tap or drag sends no mouse report
(the tap still focuses the keyboard). Click-only tracking (?9h) keeps
its arrow-key scrolling on the alternate screen, and an explicit ?1006l
still sends legacy reports.

* fix(terminal): state the default mouse encoding so legacy mouse apps keep phone input

Snapshots now say ?1006l while a program tracks the mouse with the default
encoding (daemon rehydrate and desktop pane serializer), and the phone
treats a tracking enable seen in live output as proof of its encoding.
Legacy-encoding programs such as vim with mouse=a keep phone scrolling,
taps and drags; replay-only tracking with no stated encoding still sends
nothing. An unproven drag falls back to local selection, and an empty pane
snapshot stays empty.

* chore(terminal): type the mouse-encoding tracker inputs for the low-evidence audit
2026-09-30 01:05:26 -07:00
..