[BUG] Claude Code (VS Code ▎ extension) — copying a code block ▎ injects newlines into long commands
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?
In the Claude Code VS Code extension,
▎ copying a single-line shell command
▎ from a fenced code block in the chat
▎ pane inserts a hard newline at the
▎ visual wrap point. Pasted into the
▎ integrated terminal, the command runs
▎ truncated — e.g. a long curl URL
▎ splits mid-string, and scripts/run.sh
▎ uv run python script.py splits after
▎ python, launching a bare REPL. The
▎ identical code block copied in the
▎ Claude Code Desktop app pastes as one
▎ unbroken line and runs correctly.
▎ Repro: have the model output any
▎ shell command long enough to wrap in
▎ the chat pane, copy it, paste into
▎ the terminal. Expected: one line, as
▎ in Desktop. Actual: newline(s) at the
▎ wrap point. Impact: commands fail
▎ silently-ish and need manual repair
▎ on every paste.
What Should Happen?
as you can see above, the text I copy has '|' and line breaks which make copying and pasting snippets a manual exercise of copying to TextEdit, fixing up, copying again and pasting. it should just be a copy paste or permission to allow '!'
Error Messages/Logs
Steps to Reproduce
work on anything requiring the user to run a command in the Terminal. when the snippet appears then copy, paste and you will see the error
Claude Model
Not sure / Multiple models
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.1.169
Platform
Other
Operating System
macOS
Terminal/Shell
VS Code integrated terminal
Additional Information
I am using the Claude Max rather than Claude API
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗