Forward bare Escape to PTY in normal mode#16
Merged
dcosson merged 1 commit intodcosson:mainfrom Apr 1, 2026
Merged
Conversation
In normal mode, pressing Escape with no following bytes (bare Escape) was silently dropped. This prevented Claude Code from receiving its interrupt/pause signal without first entering passthrough mode. - Add ModeNormal case to StartPendingEsc timer callback - Add PendingEsc continuation handling to HandleDefaultBytes (fixes split-read escape sequences too) - Start pending esc timer when ESC is last byte in buffer
Owner
|
Looks good, thanks! |
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.
Pressing Escape in normal mode does nothing — the keypress is silently dropped. This prevents Claude Code and other child processes from receiving bare Escape, which Claude Code uses for interrupt/pause. The current workaround requires
Ctrl+\->p-><esc>->Ctrl+\, which is clunky.HandleDefaultByteshad noStartPendingEscpath for ESC at end of buffer, andStartPendingEsc's timer callback had noModeNormalcase. Both passthrough and scroll modes already handled this correctly.This PR:
ModeNormalcase toStartPendingEsctimer — forwards bare Escape (0x1B) to PTYPendingEsccontinuation handling toHandleDefaultBytes— also fixes split-read escape sequences (e.g. arrow keys split across tworead()calls)StartPendingEsc()when ESC is the last byte in the bufferFour (4) tests cover: