Repository navigation
Conversation
Ctrl+C in the web terminal opened the Kill Session confirmation instead of reaching the PTY. Forward all xterm data through onSendInput and remove onInterrupt. Ctrl+C now interrupts the foreground program; Kill Session still kills.
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
Pressing Ctrl+C in the web terminal never reaches the program running in the PTY. The page intercepts the keystroke and opens the "Are you sure you want to kill session" confirmation instead. This PR sends every keystroke to the PTY, Ctrl+C included. The Kill Session button still kills the session.
In plain terms: in a normal terminal, Ctrl+C stops the command that is running. In the web page it popped up a "kill this session?" box instead, so a runaway command could not be interrupted from the keyboard, and answering the box with "OK" killed the whole session. Now Ctrl+C behaves as it does in any terminal.
Cause
RawTerminal.setupInputHandlingspecial-cased the\u0003that xterm emits for Ctrl+C and calledonInterrupt, whichAppwired tohandleKillSession. That handler shows aconfirm()and then deletes the session. The byte never went toonSendInput, so the PTY never saw it.I typed Ctrl+C in a real headless Chromium against a session running
sh -c 'trap "echo GOT_INT" INT; ...', answering the dialog with Cancel:Are you sure you want to kill session "ctrlc probe"?)GOT_INTprinted)Changes
terminal-renderer.tsx:onDataforwards everything toonSendInput. TheonInterruptprop and the Ctrl+C branch go away.app.tsx: stop passingonInterrupt.handleKillSessionstays and is still used by the Kill Session button.Behavior changes
Ctrl+C in the web terminal now interrupts the foreground program, as in any terminal, instead of opening the kill confirmation. To end a session you use the Kill Session button.
Validation
There is no test in this PR. The client has no React test harness and no existing e2e test types Ctrl+C. The table above comes from a throwaway Playwright probe (Chromium) that I ran on main and on this branch and did not include. I can turn it into an e2e test if you want one.
bun testovertest/*.test.ts, without the npm-pack and live suites, gives 184 passing.bun run typecheck, the build typecheck,bun run lint,bunx biome format .andvite buildare clean. The CI workflow passes on this commit in my fork, including the Playwright e2e in Chromium and Firefox.Diff
Production: -12 lines (+2/-14) in
src/web/client/components/terminal-renderer.tsxandsrc/web/client/components/app.tsx.Tests: none.