Fullscreen: Cmd+C copy never reaches Claude Code on iTerm2 because CSI >4;2m after the kitty push resets iTerm2's key-reporting flags

Status Open
Reported on v2.1.270
Maintainer reply None cached
Activity 1 comment · opened Sep 14, 2026

Preflight Checklist

  • [x] I have searched existing issues and this is not a duplicate
  • [x] I am on the latest version of Claude Code (2.1.270)
  • [x] This is a bug report, not a question

What's Wrong?

In fullscreen mode on iTerm2, Cmd+C on an in-app text selection does nothing. Ctrl+C and Ctrl+Shift+C copy fine. The docs say Cmd+c works on iTerm2 (fullscreen.md, "Use the mouse").

Root cause: Claude Code enables the kitty keyboard protocol with CSI >5u and immediately follows it with CSI >4;2m (xterm modifyOtherKeys). iTerm2 deliberately treats any CSI > 4 ; n m as a reset of the kitty key-reporting stack: VT100CSI_SET_MODIFIERS in sources/VT100/VT100Terminal.m sets _keyReportingFlags = 0 and calls removeAllObjects on the current stack (comment in source: "CSI m will nuke the stack and CSI u will respect it"). Same code on iTerm2 master. So Claude Code's own next byte wipes the kitty mode it just enabled, iTerm2 stays on its legacy key mapper, and the legacy mapper hands every Cmd combo to the menu bar instead of the app (iTermStandardKeyMapper.keyMapperWantsKeyEquivalent returns !cmdPressed).

Captured Claude Code startup output on iTerm2 (pty capture, fullscreen):

ESC[?1049h  ESC[<u  ESC[>5u  ESC[>4;2m  ESC[?1000h ... ESC[<u  ESC[>5u  ESC[>4;2m ... ESC[?u

iTerm2's reply to that ESC[?u query is ESC[?0u (flags = 0).

What Should Happen?

Cmd+C should copy the selection (the cmd+c → selection:copy default binding in the Scroll context), as documented for kitty-protocol terminals including iTerm2.

Suggested fix: send CSI >4;2m before the kitty push, or skip it when the terminal is on the kitty allowlist / the kittyKeyboard reading has settled true. modifyOtherKeys adds nothing once kitty flags are active.

Error Messages/Logs

None. Key never reaches Claude Code.

Steps to Reproduce

Environment: macOS, iTerm2 3.7.1, profile with Keys → General → Left/Right Command set to "Super" (required for iTerm2 to report Cmd at all), "Apps can change how keys are reported" on (default).

  1. Prove iTerm2 forwards Cmd as Super when only kitty is enabled. In a shell:

``
printf '\e[>5u'; cat -v; printf '\e[<u'
`
Press
Cmd+C, Return → prints ^[[99;9u` (super modifier).

  1. Add Claude Code's modifyOtherKeys byte and query the flags:

``
printf '\e[>5u\e[>4;2m\e[?u'; sleep 1; echo; printf '\e[<u'
`
Prints
^[[?0u. Without \e[>4;2m it prints ^[[?5u`.

  1. Run claude with "tui": "fullscreen", drag-select text, press Cmd+C. Nothing happens; iTerm2's Edit menu does not flash either (Copy is disabled with no native selection). Ctrl+C copies.

Is this a regression?

Unknown, not tested on older versions.

Claude Code Version

2.1.270 (macOS arm64, native binary)

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗