Copied text includes 2-space leading indentation from rendered output
Status Open
Maintainer reply None cached
Workaround ✓ Mentioned in thread ↓
Activity 14 comments · opened Mar 23, 2026
Description
When copying text from Claude Code CLI output in the terminal, each line includes 2 leading spaces that come from the rendering padding. This makes pasted text incorrectly indented, requiring manual cleanup every time.
Steps to reproduce
- Run Claude Code in any terminal (iTerm2, Terminal.app, etc.)
- Ask Claude any question that produces a text response
- Select and copy part of the response
- Paste into any text editor
Expected behavior
Copied text should not include the visual padding/margin used for rendering. The clipboard content should match the logical content, not the visual layout.
Actual behavior
Every line of copied text starts with 2 extra spaces. For example, copying a code snippet or explanation results in:
This is the first line
This is the second line
instead of:
This is the first line
This is the second line
Impact
- Pasting code snippets requires manual dedent every time
- Pasting into chat/docs/emails looks incorrectly formatted
- Rectangular selection (Alt+drag) is a workaround but not ergonomic for multi-line copies
Suggested fix
Either:
- Strip the leading padding from the content that the terminal receives (render visually but don't embed in character stream), or
- Provide a config option to control output padding (e.g.,
output.padding: 0)
Environment
- Claude Code: latest
- Terminal: iTerm2 (also reproducible in Terminal.app)
- OS: macOS
14 Comments
Found 3 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
This is quite annoying as it means when copy/pasting output from CC you first have to paste it into an IDE and unindent each line by 2 spaces.
It would be great if Claude Code could output without the two space indentation
··Would be great to either:
··- Remove the left padding from rendered output, OR
··- Add a setting in settings.json to disable the indent, OR
··- Strip the padding when text is copied to clipboard.
··written by claude code with 2 leading spaces each row
After using Claude Code all day, every day for months, it was only today that I learned of the
/copycommand.Better late than never!
Another issue is that long link in Claude code is broken in Windows terminal, because the indentation.
Can we have a setting to remove them?
<img width="1898" height="393" alt="Image" src="https://github.com/user-attachments/assets/c954bc16-a742-4645-a418-cd0ddeaf4426" />
Workaround for those who need clean output now: in a separate terminal (outside Claude Code), run watch -n1 "cat /tmp/claude/response.md | sed 's/^ //'" to monitor the file. Then, within Claude Code, run /copy after any response you want to read cleanly — this writes the last response to /tmp/claude/response.md and
the watch command will immediately display it without the leading spaces.
Please we need to be able to copy commands just from the terminal, everything else is taking too long.
most terminals pad their content anyways so its just a useless feature to pad the whole CLI program with 2 spaces..
I run into issue with this all the time doing terminal work with indent sensitive config updates, python, etc. Even an obscure setting to turn off the indent would be a huge win.
+1 - please address this. My current workaround is to ask claude to write to a tmp file which I then copy-paste from, but its quite tedious.
+1
for a while now, Claude Code CLI offers a custom selection mode that overrides the terminals own text marking:
<img width="1717" height="1495" alt="Image" src="https://github.com/user-attachments/assets/2619c430-0238-4ea5-baa5-9783673a1668" />
this fixed the issue for me.
as you can see, it copies without the left padding.
I dont know if this works in other terminals, but on Windows with the Windows Terminal and Claude Code CLI running in WSL, it works remarkably well.
Single paragraphs are even copied correctly as single lines until there is a real line break
I used to ask Claude Code to write to a file for me, but then built this tool to fix the issue: https://pypi.org/project/unwrap-terminal-text/
It's simple, but I really do find myself using it multiple times a day now
Mac users: