Skip to content

Fix Ctrl+C not exiting under the kitty keyboard protocol - #96

Open
nielsenko wants to merge 2 commits into
Norbert515:mainfrom
nielsenko:fix/ctrl-c-kitty-protocol
Open

Fix Ctrl+C not exiting under the kitty keyboard protocol#96
nielsenko wants to merge 2 commits into
Norbert515:mainfrom
nielsenko:fix/ctrl-c-kitty-protocol

Conversation

@nielsenko

Copy link
Copy Markdown
Collaborator

Ctrl+C did nothing in most modern terminals. The app could only be killed from another shell.

The binding pushes the kitty keyboard protocol (\x1B[>1u) at startup. A terminal that supports it reports Ctrl+C as ESC[99;5u rather than the raw 0x03 byte, and the tty raises SIGINT only for the byte. So the SIGINT handler (which held the only shutdown fallback) never fired. The key path parsed the event correctly, routed it through the component tree, and discarded the result, two lines below a comment claiming it would fall back to shutdown.

Fix

The key path now shuts down on an unhandled Ctrl+C, as the comment already said it did. Ctrl+Shift+C is excluded (terminals bind it to copy), and the protocol reports the two distinctly.

The kitty keyboard protocol makes a terminal send ESC[99;5u rather than
0x03, and the tty raises SIGINT only for the byte, so the signal handler
never fired. The key path now shuts down on an unhandled Ctrl+C.
Ctrl+Shift+C is excluded, being copy.
@nielsenko nielsenko self-assigned this Aug 6, 2026
Split across two files: a TerminalBinding registers VM service extensions
that cannot be undone, so only one can exist per isolate.
@nielsenko
nielsenko force-pushed the fix/ctrl-c-kitty-protocol branch from 6c2fa2e to 0eb8df9 Compare August 7, 2026 10:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant