Repository navigation
feat(ui): toggle wrapping on code blocks in your own messages - #197804
Conversation
Code fences in human messages wrap long lines by default but offered no way back to the literal line layout. Give them a wrap toggle in the corner of the block's first row, reusing the shared code-block click owner. The toggle appears only while a row soft-wraps, keeps the passive block's box, and adds no copy, reveal, or JSON tools. Turning wrapping off scrolls horizontally, with the first row fading out before the control. The pending new-chat preview shares the markup so rows do not reflow at handoff, and stays passive until Chat mounts. Co-authored-by: vyctorbrzezowski <[email protected]>
Worked on by: - @vyctorbrzezowski Co-authored-by: vyctorbrzezowski <[email protected]> OpenClaw-Publication: 716949f3-0c10-4490-abad-6a729e04b018
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs changes before merge. What this changesAdds a reversible wrapping control to code blocks in human chat messages while keeping wrapping enabled by default. Example: A sent code block contains a long https://example.com/design/ URL at a 390 px viewport width.
Review scores
ProductKind: Feature · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Needs changes before merge - 2 items remain Keep this useful, maintainer-directed PR open. The visible behavior is supported by screenshots, but two change-caused CI failures need focused repairs. Priority: P2 Before merge
Findings
Agent review detailsHow this fits togetherControl UI message presentation supplies interaction options to the shared Markdown renderers; the existing code-block owner measures overflow and handles the toggle, while CSS controls wrapping and scrolling. flowchart TD
A[Human message Markdown] --> B[Message presentation options]
B --> C[Shared Markdown renderer]
C --> D[Code block markup]
D --> E[Existing interaction owner]
E --> F[Wrapped or scrolling code]
G[Pending chat preview] --> C
Technical reviewBest possible solution: Keep the shared wrap-control implementation, update the affected side-chat assertions, and reduce stylesheet growth to satisfy the existing budget. Do we have a high-confidence way to reproduce the issue? Current-main source and the supplied before screenshot establish wrapped human code without a toggle; exact-head CI independently records the two validation failures. Is this the best way to solve the issue? Reusing the existing renderer, overflow measurement, and click owner is an appropriate small extension; the remaining repairs belong in the affected consumer test and stylesheet. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 7b75336b789c. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceAcceptance criteria:
What I checked:
Likely related people:
PR surfaceSource +97, Tests +182, Docs +1. Total +280 across 11 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. Review metrics
LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed November 12, 2026, 10:56 AM ET / 15:56 UTC. |
|
Maintainer review found one concrete defect: at maximum horizontal scroll, trailing characters remained under the fade. The unwrapped The incoming candidate failed the endpoint check at both 1180px and 390px. The corrected candidate passed actual wheel scrolling in both directions, the first-row suffix beside the toggle, long-message expansion, and the complete New Session → Chat handoff with unchanged text. The existing seven code-fence browser cases, UI typecheck, scoped lint/style/format and test-line guard pass. Independent P0–P2 review found no actionable issues. Proof scope: production Control UI with synthetic Gateway history in Chromium. WebKit, Firefox, RTL and a live provider call are not claimed. |
…aw#197804) Allow code blocks in user messages to switch between wrapped lines and horizontal scrolling through the existing Markdown control owner. Keep the pending New Session preview passive until Chat takes ownership. Include the end padding in the scrollable width so the last characters remain readable beyond the fade. Verified desktop and phone scrolling, keyboard control, unchanged text, long-message expansion, and New Session handoff. Co-authored-by: vyctorbrzezowski <[email protected]>


Related: #196070
What Problem This Solves
Code blocks in your own chat messages wrap long lines, with no way to see the lines as they were written. Long commands, logs, and URLs are harder to read when they are split across rows.
User Impact
User impact: when a line in a code block you sent wraps, a small toggle in the block's top-right corner switches the block to horizontal scrolling and back. Wrapped stays the default.
Why This Change Was Made
Human-message code fences were passive, so the wrap default from #196070 could not be turned off. They now reuse the wrap control and click handling that assistant code blocks already have, without the copy, reveal, or JSON tools.
The toggle sits in the corner of the first row instead of a toolbar row, so it adds no height to the block. Wrapped text on the first row stops short of the control. With wrapping off, the first row fades out before the control and scrolls clear of it.
The pending new-chat preview renders the same block so rows do not reflow when Chat takes over. It stays passive until then. Aligned block art is unchanged.
Accepted edge case: after turning wrapping off, widening the pane until nothing overflows hides the toggle until a row overflows again. The block reads the same in both states at that width.
Evidence
Screenshots are the real Control UI build against a mocked Gateway with synthetic messages, at 1180 px in the dark theme and 100% scale. "Before" is the original base
5cef30a310125838abdbd3400a4db3dd334e8220.Before (original base: wraps, no control)
After (wrapped, toggle in the corner)
After (wrapping turned off)
390 px, light theme
Author checks on the original candidate:
ui/src/e2e/chat-code-block-fences.e2e.test.ts: 7 passed. The new scenario runs at 1180 px (dark) and 390 px (light) and covers the default wrapped state, Enter and Space on the toggle, unchanged code text, no page overflow, no text under the control, no control on a short block, and the passive pending preview.ui/src/e2e/new-session-page.transition.e2e.test.ts: 8 passed.pnpm ui:check-performance:baseagainst the merge base flags this change's stylesheet growth: about 1.2 KiB raw and 0.2 KiB gzip of total CSS.mainis already over the total CSS cap, so the check allows no growth; it fails locally and is an advisory warning in CI. No JavaScript, startup, or request budget is affected.5cef30a. The first pass found one P2: the toggle could hide after turning wrapping off when a row fit the viewport but not its padded scroll area. That is fixed with a regression test, and a second pass on the final change reported no findings. The reviewer saw the diff only and did not run code.Not covered: WebKit and Firefox, right-to-left messages, and a live Gateway.
Requested and directed by @vyctorbrzezowski.
Maintainer verification
The review found that the end padding was outside the overflow created by the wide code child: at maximum horizontal scroll, the final characters were still faded. The unwrapped human-message
prenow sizes to its content (with a viewport-width minimum), so its existing padding remains reachable by scrolling. No new preference lookup, polling, cache, or rendering owner was introduced.The incoming candidate failed the endpoint proof at 1180px and 390px. The correction passed real wheel scrolling in both directions, the first-row suffix beside the toggle, long-message expansion, and the complete New Session → Chat handoff with unchanged code text. The existing seven code-fence browser cases, UI typecheck, scoped lint/style/format, and test-line guard pass. The two Side chat typography cases also pass after scoping assistant-control assertions to the assistant row and replacing the obsolete no-user-wrapper expectation with checks for the intended short-code behavior. Independent P0–P2 review of the complete corrected candidate found no actionable issues. The runtime logic also retains the previously passing 65 focused unit tests and eight New Session transition cases.
Current inspected screenshots and proof limits. These checks use the production UI with synthetic Gateway history in Chromium; they do not claim live-provider, WebKit, Firefox, or RTL coverage. The original author evidence remains above.
Work sessions
Linked for team reference; these sessions aren’t public.
Worked on by