fix(attach): detect ctrl+\ encoded by xterm modifyOtherKeys#125
Open
myeongjjun wants to merge 1 commit into
Open
fix(attach): detect ctrl+\ encoded by xterm modifyOtherKeys#125myeongjjun wants to merge 1 commit into
myeongjjun wants to merge 1 commit into
Conversation
PR neurosnap#92 made the ctrl+\ matcher handle the kitty CSI u encoding. The older xterm modifyOtherKeys encoding (CSI 27 ; mod ; key ~) was still missed, which broke detach when the inner program (e.g. claude) enables modifyOtherKeys level 2 and the outer terminal honors it (e.g. iTerm2). Add a separate matcher mirroring keypressWithMod, with the same lock modifier tolerance. Also force modifyOtherKeys back to level 0 in the detach restore sequence; xterm modifyOtherKeys has no push/pop, so this is unconditional, mirroring the existing unconditional disables for mouse modes, bracketed paste, focus events, and alt screen. Without it the outer shell ends up encoding ctrl combos as escape sequences after detach, corrupting input at the prompt.
Owner
|
Hi, this is on my radar, just haven't had the time to dig into the spec for these escape sequences to better understand what this PR is doing. |
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.
Fixes #124. Follow-up to #92.
The kitty CSI u parser added in #92 doesn't cover xterm modifyOtherKeys, so ctrl+\ silently fails to detach when the inner program enables modifyOtherKeys level 2 and the outer terminal honors it (notably iTerm2). Real-world trigger is Claude Code, which emits
\e[>4;2mon startup.Mirrors the #92 approach with a separate matcher for the modifyOtherKeys form:
\x1b[27;<mod>;<key>~keypressWithMod\x1b[27m,\x1b[27~,\x1b[27;5R)Also force-resets modifyOtherKeys (
\e[>4;0m) in the detach restore_seq, mirroring the existing unconditional disables for mouse modes, bracketed paste, focus events, and alt screen — without it the outer shell ends up encoding ctrl combos as escape sequences after detach.Tests in
test "isCtrlBackslash xterm modifyOtherKeys"cover lock modifier permutations, lookalikes, embedded-buffer matches, and malformed input. Existing test suite passes.