Repository navigation
Composer: the pasted text chip previews the paste and gives its real size - #36276
Conversation
…ery line break counts (red) Leo, 2026-11-05: "it says pasted text one line, but there's a lot more than this". Red on base: a one-paragraph paste reads "Pasted text · 1 line" with a five-word preview, and \r / U+2028 lines count as one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Agent-Session: https://cmux.com/deeplink/agent?id=aid-1495d79516d0468d1734
Leo, 2026-11-05: "it says pasted text one line, but there's a lot more than this ... you're previewing one, two, three, four, five words out of a multi-hundred-word pasted text bit." The chip counted only \n lines and drew each line unwrapped in monospace, so one long paragraph (a dictated message) read "1 line" with its first five words. Now a paste's card wraps its lines in the composer's font, wider (256 px), and its label gives lines (when more than one) and characters: "Pasted text · 42 lines · 1.8K characters". pasteLines and the card count \r\n, \r, U+2028 and U+2029 breaks too. Click (back into the prompt to edit), × and sending are unchanged. Text file cards keep their monospace lines. bun test test/composer-paste-text.test.tsx src/agent-session/acpmux/composer/TextAttachmentCard.test.ts: 3 fail on base, pass here (64 pass across the paste suites). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Agent-Session: https://cmux.com/deeplink/agent?id=aid-1495d79516d0468d1734
|
cmux status (one comment, edited in place; each line is updated by the job that owns it) Review App of this head (app.zip, kept 1 day)
Gallery before/after for
States
Pick other states with a Shipped in:
|
…e type check Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Agent-Session: https://cmux.com/deeplink/agent?id=aid-1495d79516d0468d1734
|
Review (codex, router-review): SHIP at 0fb7134 Reviewer: codex gpt-6-astra high, fast tier. SHIP at 0fb7134 Visual verdict: all six after captures improve readability, consistent with Claude-style attachment cards; no visible regression. No actionable findings from code review. Localization generation passed; tests could not run because Bun is unavailable. Follow-ups: none |
Leo, 2026-11-05: "And also, um, these things. Look, it says pasted text one line, but there's a lot more than this. And also, like, I feel like this is kind of a crappy preview, isn't it? Like, obviously the line count is wrong, but the other thing is, I mean, you're previewing one, two, three, four, five words out of a multi-hundred-word pasted text bit."
What was wrong
The chip for a large paste counted only
\nline breaks, and drew each line unwrapped in 11 px monospace, cut at the card's edge. A single long paragraph, such as a dictated message, read "Pasted text · 1 line" with its first five words visible.What changed
Pasted text · 42 lines · 1.8K characters, orPasted text · 5.4K charactersfor one paragraph. It never says "1 line" for a wall of text. This adds the stringcomposer.pastedChars.pasteLinesand the card's preview now count\r\n, a lone\r, and U+2028/U+2029 as line breaks. The prompt field's own paste already normalized\r, but VS Code pastes, drops and text files didn't.Captures
Gallery
agent-pane.composer:text-pasted-paragraph(inline) andtext-pasted-paragraph-strip(new; one long paragraph, Leo's case) andtext-pasted-inline(a multi-line log), at the base and at this head.text-pasted-paragraphdarktext-pasted-paragraphlighttext-pasted-paragraph-stripdarktext-pasted-paragraph-striplighttext-pasted-inlinedarktext-pasted-inlinelightTests
The tests went in first, in their own commit:
bun test test/composer-paste-text.test.tsx src/agent-session/acpmux/composer/TextAttachmentCard.test.ts\r/U+2028 lines count as one.The neighbouring paste suites also pass on head (
user-prompt-collapse,composer-paste-again,paste-chip-round-trip,new-tab-inline-field): 64 tests in total.Observed / Not run
vp fmtand oxlint are clean on the changed files.Changelog
Fixed: A pasted text chip previews the start of the paste, wrapped in the composer's font, and gives its real size in lines and characters instead of "1 line".
🤖 Generated with Claude Code
Agent session: agent session