fix(tui): never render dead code-block copy buttons#3789
Merged
Conversation
The markdown renderer drew a "⎘ copy" affordance on every fenced code block, but clicks were only hit-tested for assistant message views. Code blocks inside reasoning blocks, shell output, welcome messages, elicitation dialogs, and leantui showed a copy button that silently did nothing when clicked. - add a HideCopyIcon option to FastRenderer; hidden icons render as plain padding and record no CodeBlock hit target - suppress the icon in reasoning blocks, elicitation dialogs, and leantui, which never hit-test code-block clicks - make shell-output and welcome message copy icons functional by populating the view's codeBlocks (with the welcome envelope's line offset) so the existing click path handles them Assisted-By: Claude
docker-agent
left a comment
Contributor
There was a problem hiding this comment.
Assessment: 🟢 APPROVE
The implementation is clean and correct. The HideCopyIcon option integrates properly with the parser pool lifecycle, the line-offset calculations for welcome messages (border + padding = 2) and shell output (no envelope) are accurate, and the error paths correctly clear codeBlocks to avoid stale state. The new TestCodeBlockCopyIconsAreNeverDead test provides good coverage of the invariant being enforced.
gtardif
approved these changes
Jul 22, 2026
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.
The ⎘ copy affordance rendered by
FastRendereron every fenced code block was only wired up for hit-testing in assistant message views. In reasoning blocks, elicitation dialogs, leantui, shell output, and welcome messages the icon appeared but clicking it did nothing.The fix adds a
HideCopyIconoption toFastRenderer(exposed asmarkdown.NewRendererWithoutCopyIcon). When hidden, the icon renders as plain padding and records noCodeBlockhit target. Reasoning blocks, elicitation dialogs, and leantui — which never participate in code-block click handling — now use this renderer. Shell-output and welcome message views gain functional copy icons by populating theircodeBlocksslice (accounting for the welcome envelope's line offset) so the existingcodeBlockAtclick path handles them. A new test,TestCodeBlockCopyIconsAreNeverDead, asserts that every rendered copy icon is clickable and that surfaces incapable of handling clicks render no icon at all.