[BUG] Pasted code displays without indentation, but is stored correctly
Resolved 💬 8 comments Opened Jan 13, 2026 by firdaus-aziz Closed Mar 8, 2026
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?
When pasting multi-line indented code into Claude Code, the displayed text in the terminal shows no indentation. However, the paste-cache file (~/.claude/paste-cache/) stores the code with correct indentation preserved.
This appears to be a display/rendering bug in how Claude Code echoes pasted input back to the terminal, not an input handling issue.
What Should Happen?
Pasted code should display with indentation preserved, matching what is stored in the paste-cache.
Error Messages/Logs
Steps to Reproduce
- Copy this indented Python code:
for invoice in Invoice.objects.filter():
checker = 0
for invoice_heading in invoice.invoice_heading_set.all():
checker += invoice_heading.net
if checker != invoice.cost:
print(f"Invoice: {invoice.id}")
- Paste into Claude Code chat input
- Observe: indentation is stripped in the displayed text
- Check
~/.claude/paste-cache/- the most recent.txtfile has correct indentation
Claude Model
Opus
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.1.6
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
iTerm2
Additional Information
Isolation Test
Pasting into cat > /dev/null in the same terminal preserves indentation, confirming the terminal (iTerm2) is not stripping it.
Environment
- OS: macOS (Darwin 24.6.0)
- Terminal: iTerm2
- Login shell: fish
- Claude Code shell config: bash
- Claude Code version: 2.1.6
iTerm2 Settings Checked
TrimWhitespaceOnCopy: FalseTerminal Type: xterm-256color- No explicit BracketedPasteMode override (using default)
- No paste transformation rules
This issue has 8 comments on GitHub. Read the full discussion on GitHub ↗