Skip to content

Composer: the pasted text chip previews the paste and gives its real size - #36276

Merged
cmux-bot[bot] merged 3 commits into
feat-cmux-nextfrom
lane/pasted-chip-preview
Nov 5, 2026
Merged

cmux-bot[bot] merged 3 commits into
feat-cmux-nextfrom
lane/pasted-chip-preview

Conversation

@teamleaderleo

@teamleaderleo teamleaderleo commented Nov 5, 2026 •

Copy link
Copy Markdown
Collaborator

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 \n line 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

  • A paste's card wraps. Its lines wrap at the card's width in the composer's own font and fade at the bottom. The card keeps up to 480 characters of a paragraph, so the preview fills every line it shows. The inline chip is 256 px wide, up from 168 px, which fits two wrapped lines; the strip card is 256 px wide, up from 180 px, which fits three.
  • The size line is accurate. It shows the line count when there's more than one line, then the character count: Pasted text · 42 lines · 1.8K characters, or Pasted text · 5.4K characters for one paragraph. It never says "1 line" for a wall of text. This adds the string composer.pastedChars.
  • Every line break counts. pasteLines and 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.
  • Unchanged: clicking the chip puts its text back in the prompt to edit, × removes it, and it sends as its own text block. Text-file cards keep unwrapped monospace lines, as code reads best.

Captures

Gallery agent-pane.composer: text-pasted-paragraph (inline) and text-pasted-paragraph-strip (new; one long paragraph, Leo's case) and text-pasted-inline (a multi-line log), at the base and at this head.

State Before After
text-pasted-paragraph dark
text-pasted-paragraph light
text-pasted-paragraph-strip dark
text-pasted-paragraph-strip light
text-pasted-inline dark
text-pasted-inline light

Tests

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

  • On base: 3 fail. The label lacks a size, a one-paragraph paste says "1 line" with no wrap, and \r/U+2028 lines count as one.
  • On head: pass.

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

  • Observed: the red and green results above. vp fmt and oxlint are clean on the changed files.
  • Not run locally: the type check and the browser suites (this VM runs out of memory on them). They run on CI at this head.

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

teamleaderleo and others added 2 commits November 5, 2026 07:24
…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
@github-actions

github-actions Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

cmux status (one comment, edited in place; each line is updated by the job that owns it)

Review 0fb7134: HQ feed card · gallery before/after runs · checks

App of this head (app.zip, kept 1 day)

gh workflow run reload-build.yml -R manaflow-ai/cmux --ref feat-cmux-next -f tag=pr36276 -f ref=lane/pasted-chip-preview -f platform=macos -f backend_mode=local

Gallery before/after for 0fb7134: 16 states rendered, 4 images differ, 3666 more touched states not rendered. Images are in the run's artifact, not on this public PR; the independent review of this head reads them on its own, so the PR needs no hand-made screenshots of these states.

gh run download 41988827039 -R manaflow-ai/cmux -n gallery-advisory-36276-0fb713451ae5a74d9d4a97d8cfb9cbcb86bb9c4a (then read gallery-review.json)

States
State Theme Status Diff Picked by
agent-pane.attachment-source/before Apple System Colors Light unchanged 0% own composerAttachments.css
agent-pane.attachment-source/before Apple System Colors unchanged 0% own composerAttachments.css
agent-pane.attachment-source/corner Apple System Colors Light unchanged 0% own composerAttachments.css
agent-pane.attachment-source/corner Apple System Colors unchanged 0% own composerAttachments.css
agent-pane.attachment-source/small Apple System Colors Light unchanged 0% own composerAttachments.css
agent-pane.attachment-source/small Apple System Colors unchanged 0% own composerAttachments.css
agent-pane.attachment-source/labelled Apple System Colors Light unchanged 0% own composerAttachments.css
agent-pane.attachment-source/labelled Apple System Colors unchanged 0% own composerAttachments.css
agent-pane.attachment-source/outside Apple System Colors Light unchanged 0% own composerAttachments.css
agent-pane.attachment-source/outside Apple System Colors unchanged 0% own composerAttachments.css
agent-pane.composer/text-pasted-paragraph Apple System Colors Light new 0% own composer.gallery.ts
agent-pane.composer/text-pasted-paragraph Apple System Colors new 0% own composer.gallery.ts
agent-pane.composer/text-pasted-paragraph-strip Apple System Colors Light new 0% own composer.gallery.ts
agent-pane.composer/text-pasted-paragraph-strip Apple System Colors new 0% own composer.gallery.ts
agent-pane.composer/font-size-chat-14 Apple System Colors Light unchanged 0% own composer.gallery.ts
agent-pane.composer/font-size-chat-14 Apple System Colors unchanged 0% own composer.gallery.ts
agent-pane.composer/font-size-new-chat-14 Apple System Colors Light unchanged 0% own composer.gallery.ts
agent-pane.composer/font-size-new-chat-14 Apple System Colors unchanged 0% own composer.gallery.ts
agent-pane.composer/font-size-new-tab-14 Apple System Colors Light unchanged 0% own composer.gallery.ts
agent-pane.composer/font-size-new-tab-14 Apple System Colors unchanged 0% own composer.gallery.ts
agent-pane.composer/font-size-chat-21 Apple System Colors Light unchanged 0% own composer.gallery.ts
agent-pane.composer/font-size-chat-21 Apple System Colors unchanged 0% own composer.gallery.ts
agent-pane.composer/font-size-new-chat-21 Apple System Colors Light unchanged 0% own composer.gallery.ts
agent-pane.composer/font-size-new-chat-21 Apple System Colors unchanged 0% own composer.gallery.ts
agent-pane.composer/font-size-new-tab-21 Apple System Colors Light unchanged 0% own composer.gallery.ts
agent-pane.composer/font-size-new-tab-21 Apple System Colors unchanged 0% own composer.gallery.ts
agent-pane.composer-height/old-eight-lines-normal Apple System Colors Light unchanged 0% own markdownField.css
agent-pane.composer-height/old-eight-lines-normal Apple System Colors unchanged 0% own markdownField.css
agent-pane.composer-height/old-eight-lines-short Apple System Colors Light unchanged 0% own markdownField.css
agent-pane.composer-height/old-eight-lines-short Apple System Colors unchanged 0% own markdownField.css
agent-pane.composer-height/current-forty-percent-normal Apple System Colors Light unchanged 0% own markdownField.css
agent-pane.composer-height/current-forty-percent-normal Apple System Colors unchanged 0% own markdownField.css

Pick other states with a Gallery: entry.id, entry.id/variant line in the PR body.

Shipped in:

@github-actions github-actions Bot added the risk:normal Risk tier (docs/ci/risk-tiers.md) label Nov 5, 2026
@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

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

@cmux-bot cmux-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cmux-bot approves 0fb7134: an independent review passed this exact head (router-review receipt by teamleaderleo). A push needs a new review; a later BLOCK at this head dismisses this approval.

@cmux-bot
cmux-bot Bot merged commit 16afd28 into feat-cmux-next Nov 5, 2026
196 of 197 checks passed
@cmux-bot
cmux-bot Bot deleted the lane/pasted-chip-preview branch November 5, 2026 08:36

This branch was previously deployed

1 inactive deployment
ci-routing-agent — 0fb71345 Deployed Nov 5, 2026 by teamleaderleo via cmux-tui tree preflight #115032
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk:normal Risk tier (docs/ci/risk-tiers.md)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant