Kitty keyboard protocol leaks [57358u for Caps Lock in VSCode terminal
Description
When running Claude Code in a VSCode (code-server) integrated terminal, pressing Caps Lock outputs [57358u visibly in the terminal. This is the Kitty keyboard protocol encoding for the Caps Lock key (57358 = CapsLock in the Kitty spec).
The issue does NOT occur in a regular terminal — only through VSCode's integrated terminal.
Steps to Reproduce
- Open Claude Code in a code-server (VSCode in browser) integrated terminal
- Press Caps Lock
[57358uappears in the terminal input
Expected Behavior
Caps Lock should be silently consumed — no visible output.
Attempted Fixes (none work)
"keyboard.dispatch": "keyCode"in VSCode settings"terminal.integrated.sendKeybindingsToShell": falseprintf "\e[>0u"in bashrc to disable Kitty protocol (Claude Code re-enables it)"terminal.integrated.gpuAcceleration": "off"
Environment
- IDE: code-server (VSCode in browser)
- Claude Code version: 2.1.83
- TERM: xterm-256color
- OS: Linux (container/CDE environment)
- Shell: bash
Analysis
Claude Code enables the Kitty keyboard protocol for enhanced key handling. The protocol encodes modifier-only key presses (like Caps Lock) as CSI number u sequences. When the terminal doesn't fully support the Kitty protocol (as is the case with code-server's xterm.js-based terminal), these sequences leak through as visible text instead of being consumed.
The fix should either:
- Not enable the Kitty keyboard protocol when the terminal doesn't support it (detect xterm.js/code-server)
- Filter out modifier-only key events (Caps Lock, Shift, Ctrl, Alt alone) before they reach the input buffer
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗