agent: Cap the height of large tool output and diff blocks#59242
Open
ebertn wants to merge 1 commit into
Open
Conversation
ce4c405 to
5370dac
Compare
0d695b9 to
b90003f
Compare
ebertn
added a commit
to ebertn/zed
that referenced
this pull request
Jun 14, 2026
Folds the updated terminal rendering from PR zed-industries#59242 into build: the inline embedded terminal now sizes its box to the actual output (growing up to the cap), keeps the trailing blank cursor line clipped just below the box, and shows an expand chevron beneath. The markdown/diff block capping and settings were already present on build.
Tool output (including MCP/context server results), file diffs, and other text content blocks in the agent thread were rendered at full height, so an accidentally huge buffer could lay out thousands of lines at once and cause serious UI/scrolling performance problems. Cap each such block and reveal the rest behind an expand control: - Markdown/text output is capped at agent.tool_output_max_lines (default 10). - File diffs are sized proportionally to their length (3 + lines / 10). - A centered, transparent chevron over a bottom vignette toggles each block between collapsed and expanded (2x the cap). The vignette band is reserved on top of the cap so the intended lines stay visible above it, the chrome is skipped entirely when the buffer already fits, and the fade only draws when content is actually clipped. - Expanded blocks are scrollable and capped; collapsed blocks are static previews. Scrolling chains out to the thread at the block's top/bottom edges. - agent.tool_output_max_lines = 0 disables capping entirely. Terminal output is already bounded, so it's left as-is. The gating logic is covered by unit tests.
b90003f to
9b8e8e7
Compare
ebertn
added a commit
to ebertn/zed
that referenced
this pull request
Jun 14, 2026
A collapsed diff block was top-anchored, so it showed the leading context of the first hunk and the actual +/- changes were hidden below the fold. Anchor the collapsed preview to the first changed row (keeping one line of context above it) so the change is what's visible. From PR zed-industries#59242.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Tool output (including MCP/context server results), file diffs, and other text content blocks in the agent thread were rendered at full height. An accidentally huge buffer could lay out thousands of lines at once and cause serious UI/scrolling performance problems.
This caps each such block and reveals the rest behind an expand control.
Behavior:
agent.tool_output_max_linessetting (default 10).3 + lines / 10), so small diffs show almost fully and large diffs grow slowly.agent.tool_output_max_lines = 0disables capping entirely.Implementation notes:
render_constrained_output_blockhelper, gated on the content's line count (short outputs render unchanged). The gating logic is a pure function with unit tests.listwheel handler only checks hit-test membership (not propagation), so the block isoccluded to stop the thread from also scrolling, and we drive the block's scroll and hand off tolist_state.scroll_byat the edges.Self-Review Checklist:
Release Notes:
agent.tool_output_max_linessetting (default 10) that caps the height of large tool output and diff blocks in the agent panel behind an expandable, scrollable view, so an oversized buffer no longer degrades UI performance.