Kitty keyboard protocol not restored on Ctrl+C exit in Ghostty

Resolved 💬 5 comments Opened Mar 26, 2026 by sustanza Closed Mar 26, 2026

Description

When exiting Claude Code via Ctrl+C in Ghostty terminal, the kitty keyboard protocol is not properly disabled/restored. This leaves the terminal in a broken state where subsequent keypresses are rendered as raw CSI u escape sequences in the prompt.

Reproduction

  1. Open Ghostty terminal
  2. Run claude
  3. Press Ctrl+C to exit
  4. Try typing anything — raw escape sequences appear instead of normal characters:

``
9;5u9;5u9;5u9;5u9;5ul9;5u22;5u
``

  1. The prompt is unusable until reset is run

Expected behavior

Claude Code's SIGINT handler should pop/disable the kitty keyboard protocol mode (CSI < u) before the process exits, restoring the terminal to its previous keyboard state.

Workaround

Blindly type reset and press Enter to restore terminal state.

Environment

  • Claude Code: 2.1.84
  • Ghostty: 1.3.1 (stable)
  • macOS (Darwin 25.3.0)
  • Shell: zsh

View original on GitHub ↗

This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗