Repository navigation
fix(chat): keep whole tool-file paths in a copy past the chat, and a //server folder's paths as written (#1606) - #2195
Conversation
…//server folder's paths as written (#1606)
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 9 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…count only rendered labels (#1606)
|
Fixed in 8aaf99b:
|
|
Merging 8aaf99b after two merge-pass review rounds. Round 1 reproduced a regression on e3d095e: with two chats mounted, one chat's document copy listener took a copy made in the other chat and dropped its rich HTML. The lane fixed it in 8aaf99b, where a chat declines a selection with no part in it and a display:none label no longer counts, and added a two-chat browser check. Both reviewers pass this head, and their reproductions fail on e3d095e and pass here. The required checks are green, and CodeRabbit did not review this head. The LOW notes go to a follow-up issue. |
What it does for the user
Closes the two gaps #1606 left open after #1837 (chat tool-card file labels read from the pane's folder):
app/src/b.ts). Now such a copy carries the paths as written (/work/app/src/b.ts) whenever it takes a shown, shortened label whole. A selection past the chat that takes no shortened label stays the browser's own copy.//server/share/appwas treated as a POSIX folder, so its paths were shortened. It now reads like\\server\share\appalready did: every path as written.How
toolPathRootrefuses a//start (src/lib/workspacePath.ts).copywhere the selection starts, so a Select All never reached the chat scroller. A copy from a field (the composer, a copy button's hidden textarea, xterm's textarea) stays native.chatSelectionClipboardPayloadgrows each visible shortened label the selection takes whole, and puts the browser's ownselection.toString()on the clipboard as plain text only. It rebuilds no HTML from the page, so a composer's unsent draft, a hidden chat under a terminal peek, or folded sidebar lists cannot leak into a rich copy. A selection wholly inside the chat works as before (plain text + rebuilt HTML). Each chat on the page has its own document listener, so a chat declines a selection that has no part in it: with two chats mounted (split halves, herdr splits, a chat kept under a terminal peek), a copy wholly inside one is that chat's own, rich HTML included, whichever listener runs first.Follows T3 Code's workspace-relative paths, as #1837 did; the copy keeps the raw path the way its file labels do.
How it was verified
bun test src/lib/workspacePath.test.ts: new//server/share/appcases fail on main (toolPathRootreturned the string) and pass here.scripts/chat-tool-paths-demo-regression.ts(real Chromium, demo build, in the browser CI lane), new checks for both forms (link and bare label):app/…line, and no rebuilt HTML;//server/share/appand a//server/share/app/fwd.tscard read as written;the second chat: the copy keeps the chat's rich HTML: "").On main's code, the copy half fails (
the link, Select All: the copy keeps /work/app/src/b.ts, clipboard heldapp/src/b.ts) and the UNC half fails (machine unc); both pass here.scripts/chat-selection-copy-regression.tsandscripts/replay-clipboard-demo-regression.tspass.bun run check fastpasses.display:nonelabel counted as shown); both are fixed in the second commit.Left out
[contenteditable=true]in the field check does not matchcontenteditable=""/plaintext-only; nothing insrcuses those today.text/html) copy inside the chat still leaves a clickable tool-file label out, as on main (the follow-up feat(chat): read tool-file labels from the pane's folder #1837 named); the plain text carries the whole path.Closes #1606.