[BUG] Commands in code blocks cannot be copy-pasted directly into terminal
Resolved 💬 1 comment Opened May 26, 2026 by markus-korbel Closed Jun 27, 2026
Preflight Checklist
- [x] I have searched existing issues and this is not a duplicate
- [x] This is a single bug report
- [x] I am using the latest version of Claude Code (2.1.150)
What's Wrong?
Shell commands rendered in Claude Code's TUI output cannot be copy-pasted directly into a terminal for two related reasons:
- Long commands wrap visually in the TUI output — selecting them with the mouse breaks across lines, making it impossible to copy a long command as a single line.
- Multiline commands (backslash continuations) paste line by line — when Claude formats a command across multiple lines using
\continuations, pasting into a terminal submits each line individually on Enter, causing the first fragment to execute immediately and fail.
The combination means there is no reliable way to copy a command from Claude Code output and run it in an external terminal (e.g. Cloud Shell, PowerShell, WSL) without manually editing it first.
What Should Happen?
Commands in code blocks should be copy-pasteable as-is into a terminal. Either:
- A copy button on code blocks that copies the raw unwrapped text, or
- Commands always rendered as single lines in code blocks (no
\continuations), or - Both
Steps to Reproduce
- Ask Claude to produce any
azCLI command or other long shell command - Claude renders it with
\line continuations across multiple lines in a code block - Try to copy and paste into Windows Terminal / PowerShell / Cloud Shell
- First line executes immediately on paste, rest fail
Is this a regression?
No, never worked
Claude Code Version
2.1.150
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
Windows Terminal
Additional Information
Current workaround: ask Claude to write the command to a .ps1 file and run that — but this doesn't work for remote terminals like Azure Cloud Shell where local files aren't accessible.
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗