Kitty keyboard protocol leaks [57358u for Caps Lock in VSCode terminal

Resolved 💬 3 comments Opened Apr 6, 2026 by beaudet Closed Apr 6, 2026

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

  1. Open Claude Code in a code-server (VSCode in browser) integrated terminal
  2. Press Caps Lock
  3. [57358u appears 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": false
  • printf "\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:

  1. Not enable the Kitty keyboard protocol when the terminal doesn't support it (detect xterm.js/code-server)
  2. Filter out modifier-only key events (Caps Lock, Shift, Ctrl, Alt alone) before they reach the input buffer

View original on GitHub ↗

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