Repository navigation
Copy visible text for code, formatted spans and plain prose selections - #6487
Merged
Merged
Conversation
Selection copy escaped every `_ [ ] < > \` in prose, so copying config_loader.py, C:\Users\me or arr[0] pasted backslashes. Escape a character only where Markdown would otherwise reinterpret it, and check that copied prose renders back to the same text. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Copying a word inside bold, italic, strikethrough or a link pasted its Markdown (**word**, [word](url)), the same problem #6484 had with inline code. Copy the visible text whenever the selection stays within one such span, and keep Markdown for wider selections and Add to chat. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Thanks folks! 🎉 |
This was referenced Nov 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🚨 SLOP COP 🚨 ·
new-issue-autopilotHuman comments
What was wrong
Selection copy writes Markdown to
text/plain, so Markdown syntax leaked into pastes where people expect the visible text (the same class as #6376 and #5776):valet restart nginxpasted`valet restart nginx`. Onlyprebypassed the serializer.**important**or[deployment](https://example.com/deploy).escapeTextescaped every\ ` * _ [ ] < >, so copyingconfig_loader.py,C:\Users\me\notes.txtorx < y, arr[0]pastedconfig\_loader.py,C:\\Users\\me\\notes.txtandx \< y, arr\[0\]. It also turned<https://example.com>into<https://example.com\>, which re-renders as the wrong URL.What changed
selectionClipboardcopies the visible text when the whole selection sits inside onepre, inlinecode, link,strong/b,em/iordel/sspan. Wider selections, cross-message selections and Add to chat keep Markdown. Math inside such a span still copies as TeX, because KaTeX's hidden duplicate layout would otherwise be pasted twice.escapeTextescapes a character only where Markdown would reinterpret it:_unless between letters or digits,\before punctuation or at the end,[and>at line start,]before(,[or:,<before a tag or autolink start, and always`and*.How you verified
Real app (
pnpm start:worktree, headless Chromium, real mouse triple-click, double-click and drag on an agent reply, reading the copy event'stext/plain), main compared with this branch:valet restart nginx`valet restart nginx`valet restart nginxmy_old_varin prosemy\_old\_varmy_old_varOpen C:\Users\me\notes.txtparagraphC:\\Users\\me\\notes.txtC:\Users\me\notes.txtx < y and y > z, arr[0]paragraphx \< y and y \> z, arr\[0\]**important**important[deployment](https://example.com/deploy)deploymentNew tests: visible-text copy for every span type across five selection shapes; a round trip that copies tricky prose, re-renders the copied Markdown and requires the same text (fails on main for the over-escaped cases and the autolink); math inside bold (fails without the math guard). Four existing tests that pinned the old Markdown-around-a-span output were updated.
pnpm exec turbo run test --filter=@bb/app -- src/components/thread/timeline src/components/secondary-panel src/lib src/components/ui/markdown-preview: 215 files, 2173 passed.pnpm exec turbo run lint typecheck --filter=@bb/apppasses.Not verified: native Cmd+C in bb Desktop or Android (same DOM copy path).
Fixes #6484
🤖 Generated with Claude Code