[BUG] Kitty keyboard protocol not reset on exit — Windows Terminal + PowerShell
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
- Open Windows Terminal (Preview v1.25.622.0) with PowerShell 7.6.0
- Run
claudeto start a Claude Code session - Have a brief conversation
- Press Ctrl+C to exit (or let the session end)
- After returning to the PowerShell prompt, press Ctrl+C or other key combos
- 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
}This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗