fix(attach): stop wheel scroll typing arrows and keep quick detach armed through terminal replies#27
Merged
Merged
Conversation
…med through terminal replies Two attach-client bugs reported against v0.2.0: Mouse wheel typed up/down arrows into the agent. Alternate scroll mode (?1007, default-on in VTE terminals) converts wheel motion into arrow keys on the alternate screen when mouse reporting is off. screenEnter now saves the user's setting (XTSAVE) and disables the mode; screenExit restores it (XTRESTORE) before leaving the alt screen. The left-arrow quick detach only worked after pressing Enter, even with nothing typed. Terminal replies to agent queries arrive on stdin — Ink agents request the cursor position on every render — and every reply poisoned the empty-box estimate: completed CSI sequences latched unknown, DA1 replies overflowed maxEscLen, and OSC/DCS payload bytes counted as typed runes. The filter now classifies terminal-generated traffic (CPR/DA1/DSR/kitty/mode reports, mouse and focus events) as neutral via seqPoisons, consumes OSC/DCS/SOS/PM/APC strings verbatim through their terminator, and sizes maxEscLen for replies (64).
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
Two attach-client bugs reported against v0.2.0. Both live entirely in
uam __attach; session hosts are untouched.Wheel scroll typed up/down arrows into the agent
Alternate scroll mode (
?1007, default-on in VTE terminals) converts mouse wheel motion into arrow keys on the alternate screen when mouse reporting is off — introduced by #23 moving the bridge onto its own alt screen.screenEnternow saves the user's setting (XTSAVE) and disables the mode;screenExitrestores it (XTRESTORE) before leaving the alt screen. Terminals without?1007ignore all three sequences.Behavior note: for agents that don't enable mouse reporting, the wheel is now inert in-session instead of typing arrows (uam has no scrollback viewer yet); mouse-aware agents are unaffected.
Left-arrow quick detach only worked after Enter
Terminal replies to agent queries arrive on stdin — Ink-based agents request the cursor position on every render — and every reply poisoned the empty-box estimate: completed CSI sequences latched
unknown, DA1 replies overflowedmaxEscLen(8), and OSC/DCS payload bytes counted as typed runes. The filter now:seqPoisons): private-prefix CSI (</?/>) and reply/event finals (CPR, DA1, DSR, mode/window reports, focus in/out, legacy mouse)maxEscLenfor replies (64; a DA1 attribute list runs ~40 bytes)Real keystrokes (arrows, function keys, alt/meta chords, tab) still disarm the quick detach as before. One documented, test-pinned trade-off: xterm's modified F3 (
CSI 1;2R) shares its grammar with a cursor position report and is treated as a reply — CPR is constant Ink traffic, while no supported agent binds modified F3 to text entry.Testing
?1007disable/restore assertions in the TTY terminal-state test-raceon the session package🤖 Generated with Claude Code