Repository navigation
fix(native-chat): let code blocks grow to their full height - #26021
Conversation
The 320px cap made long code a scroll-within-a-scroll.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (1)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review. 📝 WalkthroughWalkthroughThe native chat code block no longer applies a maximum height to its preformatted content. Horizontal overflow handling and the other listed styles remain unchanged. Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to Code blocks can now grow to their full height as intended, while the surrounding transcript and constrained cards remain scrollable. No actionable merge risk is evident. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Description checkExplanation The description explains the change, its reason, scope, tradeoff, and testing. It does not include the required before-and-after visual proof or the allowed N/A explanation. The Linked Issue section is also missing; the template requires an issue link for outside contributors.
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment ✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
|
Screenshots and reviewThe problem: a fenced code block in a native chat reply stopped at 320px and scrolled inside its own box, so reading a long snippet meant scrolling a small box inside the chat you were already scrolling. What changes for you: a code block now shows every line, and only the chat scrolls up and down. Long lines still scroll sideways inside the block. Before (main): a 60-line block stops at about 310px and scrolls inside itselfAfter (this PR,
|




ELI5
Code blocks in the native chat stopped growing at about 320px tall. Anything longer scrolled inside its own small box, so reading a long snippet meant scrolling a box inside the chat you were already scrolling. Code blocks now show all of their lines.
What Changed
Before, a fenced code block in a chat message was at most 320px tall and scrolled vertically inside itself. After, the block is as tall as its code, and the chat transcript is the only thing that scrolls vertically. Long lines still scroll sideways inside the block.
The change removes the
max-h-80class from the<pre>inNativeChatCodeBlock. Every place that renders chat markdown uses that component, so assistant messages, reasoning, notices and the approval card all pick it up.Reasoning and the approval card keep the height limit on their own outer container, so a long block there scrolls with that container. Tool output, diff cards and command previews are separate components and keep their limits.
Why
Reading code and getting an overview of it is the point of a code block, and a 320px window works against that. The cap came in with the copy button change (#20357) and nothing else depends on it.
I considered raising the cap and adding an expand toggle. Both still hide code by default and the toggle adds a control to every block, so removing the cap is the smaller change and matches what the user wants to see.
One known tradeoff. On a very tall block the copy button sits at the top and scrolls out of view with it. A sticky header would fix that, but it needs the block's markup rearranged, so I left it out of this PR.
Testing
pnpm test src/renderer/src/components/native-chat/NativeChatCodeBlock.test.tsxpasses.pnpm lintandpnpm tcpass on the branch rebased onto currentmain.No test added. The change is one removed class, and a test for it could only assert that the class is absent.
Review
Agent skill upstream boundary
docs/reference/agent-skill-sharing-upstream-boundary.mdand copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.Notes
Renderer styling only. It behaves the same on macOS, Linux and Windows, for SSH and folder workspaces, and it changes nothing a client and host exchange. The mobile app does not use this component.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)