Agent chat: tool blocks wrap or fade at the right edge, preview fades, no resize cursor over a docked chat

Merged
TE
15d ago
+1642-78

Problem

Leo's report on tool-call blocks in agent chat (diffs like "Edited codex-excursions.md +21 -0", Ran-command Shell blocks, tool output):

  1. Long lines ran off the right edge with no scrollbar and no sign that more text was there.
  2. Hovering near the end of the file name showed a resize cursor.
  3. The 8-line preview ended on a hard edge.

Fix

Wrapping and overflow (webviews)

  • Each block has a kind. Prose files (md, txt, rst, adoc, org, tex…) wrap by default with a hanging indent. Code does not wrap. Shell and tool output wrap, which is how they looked before.
  • Wrap lines is a new toggle in the block header, just before Copy. It is a hover pill with an aria-label and no title. The choice is saved per kind in localStorage (cmux.agentPane.blockWrap) and applies to every block of that kind.
  • An unwrapped block whose lines run past the right edge fades out there. The fade goes once the block is scrolled to the end. This also works inside @pierre/diffs' shadow root, through unsafeCSS. Pages never style scrollbars and the overlay thumb shows only while scrolling (SCROLLBARS-THIN in scrollers.ts), so the fade is the sign of more text when nothing is moving; no always-visible bar is drawn.
  • Trackpad swipes and Shift-wheel scroll the block. On the native side, PageInputReadiness.sidewaysScript now looks inside open shadow roots, so a swipe over a Pierre code row stays with the page instead of going to the layout strip.

Preview

  • Diffs, Shell blocks and tool output show their first 8 lines under a bottom fade (a mask, not a hard cut), with "Show all N lines" and then "Show less". Find in Chat opens the preview when it reveals a block.
  • A long Shell block's old "Show all output" appears only after the preview is open. The permission panel's Shell block is never cut: an approval shows the whole command.

Resize cursor (native)

  • Culprit: DividerHandleView.resetCursorRects (Packages/macOS/CmuxNext/Sources/CmuxNextLayout/Views/DividerHandleView.swift:118 on base) added its whole bounds as a cursor rect. ScreenContentView+Motion.swift:129 hid a strip divider only when it was entirely outside the uncovered area. A divider that ran partly under a docked chat column therefore kept its resize cursor over the chat, and AppKit cursor rects ignore views stacked on top.
  • Now the handle has a cursorClip: the uncovered area, cut to its area's window. Both the cursor rect and the layout mouse areas (ScreenDividers.mouseAreas) stay inside it.
  • The only webview resize handle, .acpmux-chat-inspector__resize, sits at the inspector's own edge and is not the cause.

Gallery: new states edit-long-line-code, edit-long-line-prose, edit-preview-open and shell-unwrapped-long-line. shell-long-colored-output now opens the preview first.

Overlap:

  • #23161 (EditedFilesCard uses EditDiff) gets the same header and preview.
  • #23081: header lines in CommandRow, ToolRow and ToolGroupRow and its CSS rules are untouched. The only CommandRow change is outside that range (the Find reveal counter). New CSS sits next to the .cv-tool rules.
  • BackgroundTaskNote.tsx and UserBubble are untouched.

Localization: new plural key transcript.showAllLines in all 21 locales. en and ja are translated; the other 19 are machine drafts marked needs_review, with Arabic plural forms checked to keep {n}. "Wrap lines" reuses the existing changes.wrapLines.

Changelog

  • Fixed: Long lines in agent chat diffs, commands and output now wrap (prose and output) or fade at the right edge (code). The new Wrap lines toggle sits beside Copy, the 8-line preview fades out instead of cutting off, and a resize cursor no longer shows over a docked chat.

Testing

Webviews (JSDOM, fleet):

  • Red on the test commit 680170d36e0: cmux-ci run --class light --key tbo-red-680170d36e02 --script scripts/ci/run-webviews-tests.sh --env CMUX_WEB_TEST_FILES=test/transcript-block-overflow.test.tsx --ref 680170d36e027508c268d308f3778ac2840257c0 reported 0 pass, 8 fail, exit 1.
  • Green on the fix 9051c2365f2: the same script with transcript-block-overflow plus the neighbouring transcript, edited-card and permission tests, key tbo-green-9051c2365f26. Result is still pending; it will be posted as a comment.

Swift (fleet, scripts/ci/run-swift-testing-suites.sh Packages/macOS/CmuxNext):

  • Red: the test commit b5559925eee merged with base 1a71fc9a582, key tbo-native-red-e5356c7282ff.
  • Green: this head, key tbo-native-green-ecd54effe896.
  • Results are pending and will be posted as a comment. Earlier runs could not compile because of a base red in PaletteMenuVocabularyTests, which df294f83783 has since fixed.
  • New tests: DividerCursorUnderDockTests, plus a shadow-root case in PageSidewaysScrollerTests.

scripts/web-lint.sh and scripts/cmux-next/prepush-gate.py both passed.

Observed / Not run

No capture: the fix is a native cursor rect (a resize cursor can't be shown in a still); webview states are in the gallery advisory run.

  • Observed: the red webviews fleet run (8 failures), web-lint, prepush-gate, and a clean merge of the native branch and base.
  • Not run: the app itself was not built here (no app builds on this Mac). It is not confirmed in a running app that the divider is the cursor Leo saw; that conclusion comes from reading the code. The swipe-inside-shadow-root fix was likewise not tried in the app. No Playwright test covers "no resize cursor anywhere in a block" (the native cursor is outside the page). The gallery stills render in the advisory gallery run.

Agent session: cosmic-gray

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.


Summary by cubic

Fixes agent-chat tool blocks: long lines no longer run off the right edge with no sign of more, previews fade instead of cutting hard, and a strip divider's resize cursor stops at a docked chat pane.

  • Prose rows wrap by default with a hanging indent; code stays whole and fades at its right edge, with a Wrap lines toggle beside Copy remembered per block kind in localStorage.
  • Diff, Shell, and tool-output blocks past eight lines show their first lines under a fade with "Show all N lines"; an edit awaiting approval is never cut, Find in Chat skips preview buttons and opens a cut block whose match lies past the cut, and an output opened while short stays whole as it streams ("Show all N lines" counts every line, never just the tail).
  • A strip divider's cursor, hover, and drawn line stop where a docked pane begins, and sideways trackpad swipes reach scrollers inside shadow roots.
  • New tests cover the docked-divider cursor clip, shadow-root sideways scrolling, preview behaviors (including Find's reveal opening a cut diff), and the wrap/preserve preference.