[BUG] Kitty keyboard protocol not reset on exit — Windows Terminal + PowerShell

Resolved 💬 5 comments Opened Mar 26, 2026 by mynameistito Closed Apr 16, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

After exiting Claude Code (especially via Ctrl+C), the kitty keyboard protocol stays active. The terminal keeps printing raw escape sequences as literal text when you press keys:

  • Ctrl+C prints [99;5u
  • Other combos produce similar garbage ([27u, [9;5u, etc.)

This happens because Claude Code never sends the pop sequence (CSI < u) on exit. It doesn't happen every single time, which points to a race condition somewhere in the cleanup or signal handler path.

Related issues (all macOS/Linux/WSL):

  • #38840 — Kitty keyboard protocol not popped on exit (Ghostty, macOS)
  • #38829 — Kitty keyboard protocol not reset on exit causing terminal corruption
  • #39242 — Raw Kitty keyboard protocol sequences leak on modifier-only keypresses (WSL2)

Same root cause, different platform: Windows + PowerShell + Windows Terminal.

What Should Happen?

Claude Code should pop every kitty keyboard protocol level it pushed before the process exits, no matter how you quit (clean /exit, Ctrl+C, whatever). The terminal should go back to its default keyboard mode.

Error Messages/Logs

❯ lgtm

● Great, glad that works for you.

──────────────────────────────────────────────────────────────────────────────
❯
Resume this session with:─────────────────────────────────────────────────────
claude --resume 83369484-09ba-4bc6-9dae-ecaa9e80775e
~\mynameistito [99;5u

Steps to Reproduce

  1. Open Windows Terminal (Preview v1.25.622.0) with PowerShell 7.6.0
  2. Run claude to start a Claude Code session
  3. Have a brief conversation
  4. Press Ctrl+C to exit (or let the session end)
  5. After returning to the PowerShell prompt, press Ctrl+C or other key combos
  6. Observe raw escape sequences printed as text instead of normal behavior

Claude Model

Opus 4.6 - Medium Thinking

Is this a regression?

I don't know

Claude Code Version

2.1.84 (Claude Code)

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

Windows Terminal

Additional Information

Environment:

  • Windows 11 Pro 10.0.26200
  • Windows Terminal Preview v1.25.622.0
  • PowerShell 7.6.0
  • Oh My Posh (prompt customization)

My current workaround: Add a kitty protocol reset to the PowerShell prompt function:

function global:prompt {
    # Reset kitty keyboard protocol
    [System.Console]::Write("`e[<u")
    # ... rest of prompt
}

View original on GitHub ↗

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