Skip to content

fix(ui): wrap long inline code and truncate oversized chips in timeline text - #249

Merged
iamnbutler merged 2 commits into
mainfrom
long-inline-code
Oct 14, 2026
Merged

iamnbutler merged 2 commits into
mainfrom
long-inline-code

Conversation

@iamnbutler

Copy link
Copy Markdown
Contributor

Fixes #174. Long inline code in timeline messages now wraps instead of being clipped, and oversized mentions and document chips are truncated with an ellipsis and a tooltip.

Change

  • Inline code is now a breakable Pretext item: break: "never" is gone in blocks/parse.ts. Pretext wraps it at word boundaries, after /, and for overlong runs at grapheme boundaries (overflow-wrap: break-word behavior). Short code spans can now wrap at their spaces too, as browsers do with inline code by default.
  • blocks/text.tsx renders code at Pretext's own breaks, using the same wrapsAt and Wrap mechanism from fix(ui): render timeline text with the line breaks it was measured with #175 that text and links use. This works on both the settled and streaming paths, so the measured height and the rendered lines agree. If a line starts at the beginning of the code item, that break stays outside <code>, so no empty padded box is drawn at the end of the previous line.
  • Pretext adds extraWidth (the code padding) to every line fragment of a wrapped item. <code> uses box-decoration-break: clone so each fragment draws that padding too.
  • Mentions, document and plan chips, and emoji still can't break. When one is wider than its line, it is truncated with an ellipsis inside .line-clip, and the clip carries the full text as a title. Chip names sit in a .chip-name span so the ellipsis applies inside the chip and the chip shape is kept.

Verification

  • bun types and bun run ci passed.
  • Real Chromium render. I used a temporary Vite page (not committed) that mounts the real Timeline with human and agent messages. It ran in headless Google Chrome through playwright-core. The messages were:
    • the issue's example: Run `bun apps/host/src/cli.ts backup 98d620b37665c43a /tmp/…/issue-triage-backup` now please.
    • a 96-character code token with no spaces
    • short code spans
    • an oversized mention and an oversized document chip
  • Checks at every width from 360 to 1100px (741 widths). A width fails on any of these:
    • vertical overflow in a measured block
    • a measured height a full line or more taller than the painted text (blank space)
    • text painting above or below the block
    • visible text painting more than 2px past the right edge
    • a <code> rect past the content edge (clipped code)
    • a truncated chip without a title
  • Before (stashed change, same harness): all 741 widths failed. The code was clipped in every code message.
  • After: 0 of 741 widths failed. Text painted at most 0.39px past the content edge, which is subpixel drift into the bubble padding.
  • I looked at the screenshots at 360px and 1100px. The full code text is visible across wrapped lines, bubble heights fit their content, and chips show ….
  • Copying a whole message at 360px gives the original single-line text, with no newlines from the wrap points.
  • Not verified:
    • The streaming render path was only type-checked. It shares the same wrap offsets, but no live stream ran.
    • No native desktop (Electron) run. box-decoration-break is unprefixed in Chromium 130+, and the -webkit- form is set as well.
    • Root font sizes other than 16px weren't swept.

Built in Ace

No. Made by a Claude Code subagent in a terminal at the maintainer's choice for this session; not an Ace capability gap. Dogfooding: #5.

…ne text

Why: packages/ui/src/components/blocks/text.tsx#function codeStyle | Inline code is a breakable Pretext item whose extraWidth is charged per line fragment, so wrapped <code> must keep box-decoration-break: clone or rendered lines drift from measured ones.
@iamnbutler
iamnbutler merged commit feb8b33 into main Oct 14, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Oversized inline code and chips in timeline messages are silently clipped

1 participant