[BUG] iTerm2: Display duplication and paste misplacement
Preflight Checklist
- [x] I have searched existing issues — this relates to #778, #407, #10413
- [x] This is a single bug report
Environment
- Platform: Anthropic API
- Claude CLI version: v2.0.76
- Operating System: macOS
- Terminal: iTerm2 (issue does NOT occur in Apple Terminal)
Bug Description
Two issues occurring specifically in iTerm2:
1. Display Duplication
The Claude Code interface renders the same output dozens of times. Pressing / to open the slash command menu results in the menu being displayed 50-100+ times in succession, creating a massive wall of duplicated text.
This appears related to #778 (ctrl-r flickering) and #10413 (command line displayed many times), but occurs with different triggers.
2. Paste Misplacement
When pasting from clipboard (Cmd+V), content sometimes appears at a location other than where the cursor is positioned — beginning of line, end of line, or previous line.
Steps to Reproduce
Display Duplication:
- Open Claude Code in iTerm2
- Type
/to open slash command menu - Observe menu rendering 50-100+ times
Paste Misplacement:
- Open Claude Code in iTerm2
- Start typing a prompt
- Position cursor mid-prompt
- Paste clipboard content (Cmd+V)
- Content appears at wrong position
Expected Behavior
- Slash command menu renders once
- Paste inserts at cursor position
Actual Behavior
- Interface elements render dozens of times
- Paste inserts at unpredictable locations
Workaround
Using Apple Terminal instead of iTerm2 avoids both issues.
Related Issues
Claude Code:
- #778 — ctrl-r causes convulsive flickering in iTerm2
- #407 — Terminal rendering fails completely (buffering issue)
- #10413 — Terminal display broken, command line displayed many times
iTerm2 GitLab:
- #11228 — Paste doubles clipboard content
- #10454 — Copy/paste severely messed up
- #6701 — Cursor position off by one
Additional Context
This may be an interaction between Claude Code's TUI renderer (Ink/React) and iTerm2's escape sequence handling or GPU rendering. The pattern suggests either:
- Claude Code is emitting redundant render cycles that iTerm2 doesn't deduplicate
- iTerm2 is misinterpreting cursor positioning escape sequences from the TUI
The fact that Apple Terminal works correctly suggests the issue is specific to how iTerm2 handles Claude Code's terminal output.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗