Why text copied from Claude Code has broken lines and extra spaces
You select a paragraph Claude Code wrote, press ⌘C, and paste it into a pull request, a doc or another prompt. What arrives looks like this:
⏺ The flaky test comes from a race in waitForServer(): it polls⏎ the port before the listener is bound, so on a slow CI runner⏎ the first request hits nothing.··················
Every line ends where your terminal window ended, each one starts with two spaces, the reply carries a ⏺ in front, and there may be invisible spaces at the end of every line. In a chat box or a Markdown file, that's a mess to clean up by hand.
You're not imagining it, and it isn't your terminal's fault alone. The GitHub issue “Copy/paste from terminal includes unwanted indentation and trailing spaces” has been open since January 2026 with more than 300 upvotes, and a separate tracking issue lists dozens of open copy and paste problems across terminals.
Why it happens
A terminal is a grid of character cells. Programs like Claude Code don't hand the terminal paragraphs; they draw text into rows of that grid. Claude Code lays out each reply itself: it wraps the text at the window width, indents it so it lines up after the ⏺ marker, and fills the rest of the row.
When you select text, the terminal copies the rows you highlighted. Most terminals can tell a line they wrapped themselves (because text ran past the edge) from a line the program ended on purpose, and rejoin only the first kind when you copy. Because Claude Code does the wrapping before the text reaches the terminal, every row looks deliberate, so each one becomes its own line in your paste, indent and padding included.
That's also why results vary: different terminals, full-screen mode and different Claude Code versions draw and copy slightly differently. Some people in the issue report it's better in one terminal and still broken in another.
Four ways to get clean text
1. Use /copy for whole replies
Claude Code has a /copy command that copies a reply as its original Markdown, without going through the screen at all. It's the cleanest option when you want the whole reply or a whole code block. It doesn't help when you only want one paragraph, a single command or a link from the middle of a reply.
2. Make the window wider before you copy
Fewer, longer lines mean fewer breaks to fix. It doesn't remove the indent, the ⏺ or the padding, and you'll still get breaks in long paragraphs.
3. Paste through a cleaner
The free terminal text cleaner joins the lines a wrap cut, removes ⏺ and ⎿, trims padding, rejoins split links and turns box tables into Markdown tables. It runs in your browser, and it leaves line-by-line output like logs and code alone.
4. Let your Mac fix it as you copy
Claude Code saves every conversation as a file in ~/.claude/projects on your Mac, with each reply's original Markdown. Unwrap uses that: when you copy from a terminal, it finds the reply your selection came from and puts the exact Markdown on your clipboard, bold, lists, code and all. When there's no saved reply to match, it falls back to the same cleanup as the web tool. It does the same for Codex, which keeps its sessions in ~/.codex/sessions.
Quick reference
| You want | Best option |
|---|---|
| A whole reply or code block | /copy in Claude Code |
| One paragraph, list or command, once | The terminal text cleaner |
| Every copy fixed, with the original Markdown | Unwrap for Mac (free) |