fix: stop Left and Esc from detaching the switcher - #25
Merged
Conversation
Left only moves the composer cursor. Esc clears the composer, returns to the job the switcher was opened from, or leaves when there is no job to return to. Ctrl-C clears the composer and leaves on a second press within 2 seconds; Ctrl-D twice does the same; Ctrl-Q still leaves immediately. Unknown CSI sequences (Delete, Home, PageUp, Ctrl-Left) are consumed whole instead of leaking bytes into the composer. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GJRuZLJk4cT5dvakGL1Wgy
Re-resolve the source job at Esc time so a removed job detaches instead of stranding the client on the standby screen. Key the Ctrl-C/Ctrl-D confirmation to the same key, clear text on either, disarm on any other key, and drop the hint once the 2-second window lapses. Drain over-long CSI sequences whole and widen the inter-byte timeout to 100 ms so split arrows over slow links stay arrows. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GJRuZLJk4cT5dvakGL1Wgy
Exercise Left, Esc, Ctrl-C, Ctrl-D, and whole-CSI consumption in the switcher: Left never detaches, stray Delete/Home/Ctrl-Left bytes stay out of the composer, Ctrl-C and Ctrl-D clear text, only a same-key double press within 2 seconds detaches, the hint lapses on its own, typing disarms it, and Esc returns to a live source job, detaches when that job is gone, and detaches from a bare hub. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GJRuZLJk4cT5dvakGL1Wgy
The task snapshot is taken before the key wait, so a job removed in that window still looked alive and Esc switched to a dead session, stranding the client on the standby screen. Ask tmux whether the session exists when Esc is pressed; macOS CI hit the race. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GJRuZLJk4cT5dvakGL1Wgy
This was referenced Aug 31, 2026
Merged
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.
Problem
In the session switcher,
Leftwith an empty composer detached the tmux client — and so did a bareEsc, because the key parser's fallback for an unrecognised escape was"left". Unknown CSI sequences (Delete,Home,PageUp,Ctrl-Left) leaked trailing bytes (~,;5D) into the composer as text, andCtrl-C/Ctrl-Dwere silently ignored. The least deliberate keys exited; the reflex keys did nothing.Change
Mirrors the cascade of Claude Code's agent view (
Escclears → else leaves;Ctrl-Cclears → twice leaves) while keepingCtrl-Qas the instant exit.LeftEscCtrl-C/Ctrl-DCtrl-QDelete/Home/PageUp/Ctrl-arrowsParser now reads CSI parameter bytes up to a final byte (
0x40–0x7E), drains over-long sequences, keeps SS3 arrows and bracketed paste, and widens the inter-byte timeout from 30 ms to 100 ms so an arrow split across a slow link stays an arrow.Verification
python3 -m unittest tests.test_profiles tests.test_release tests.test_provider_evidence tests.test_provider_probe: 122 OKpython3 tests/hub_pty.py(macOS, tmux 3.7c): passes with a new_exercise_switcher_keysblock; the block fails againstmain's binary at its first assertion (Left on an empty composer detached the client)🤖 Generated with Claude Code
https://claude.ai/code/session_01GJRuZLJk4cT5dvakGL1Wgy