Assistant message prefix + indent + wrap breaks command copy-paste

Resolved 💬 1 comment Opened May 27, 2026 by paynote-jal Closed May 27, 2026

What

Assistant messages in Claude Code's TUI are prefixed with and rendered with a left indent applied to continuation lines. Long lines also wrap at a width narrower than the host terminal, without inserting line-continuation characters (e.g. trailing \).

The net effect: when an assistant message contains a shell command — which is the single most common piece of output in agentic use — you cannot reliably copy-paste it back into your shell. Either:

  1. The leading whitespace gets selected and pasted, producing things like aws ecs update-service ... that zsh accepts but is visually annoying, or
  2. A wrapped line gets pasted with the wrap point treated as a hard newline, so e.g. aws ecr get-login-password --region us-east-2 | docker login --username AWS \n --password-stdin <registry> becomes two separate failed commands.

Steps to reproduce

  1. Have Claude print a moderately long shell pipeline as a plain (non-fenced) text response, e.g.:

aws ecr get-login-password --region us-east-2 | docker login --username AWS --password-stdin 926936340144.dkr.ecr.us-east-2.amazonaws.com

  1. Triple-click + copy that line in the terminal.
  2. Paste into the same zsh.

Observed: the paste shows two-space indent on continuation lines, and the line is split at the wrap point. The shell sees --password-stdin as a separate command (command not found).

What I'd want

A copy-paste mode that:

  • Either omits the prefix/indent on lines that look like code (single token followed by args, or contained in a fenced block), or strips them on copy.
  • Keeps long pipelines as one logical line (don't soft-wrap at all in code-like content, or insert real \ continuations).
  • Optionally: a key (y / c) to copy the most recent command-looking block verbatim, like Aider's /copy.

Why it matters

The assistant produces 5–20 shell commands in a typical session. Each one currently risks being mangled on paste. Workaround today is for the assistant to write everything to /tmp/foo.sh and tell the user to run bash /tmp/foo.sh — that defeats the inline-output design.

View original on GitHub ↗

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