You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix: add copy controls to elicitation messages - #4992
Clicking a fenced-code copy label copies the original, unwrapped code. Press Ctrl+O to copy the entire message as Markdown, without the elicitation answer. Drag selection remains unavailable.
Adds tests for code-label hit testing (including wrapped, scrolled, resized, and moved dialogs), whole-message copying, and help layout.
Validation previously completed: build, full tests, focused race test, vet, and scoped lint passed. Full lint reported three errors in unchanged test files. No live terminal retest was performed.
This PR adds copy controls to full-TUI elicitation dialogs, reusing the message component’s clipboard handling while keeping form answers out of whole-message copies.
Changes:
Add clickable code-block copy labels and a Ctrl+O shortcut for copying message Markdown.
Wrap footer help text and include its rows in dialog layout calculations.
Add copying and layout regression tests, and document the controls.
File
Description
pkg/tui/dialog/elicitation.go
Adds copy controls, label hit testing, and wrapped footer layout.
pkg/tui/dialog/elicitation_copy_test.go
Tests copying, scrolling, resizing, moving, and help layout.
pkg/tui/components/messages/clipboard.go
Exports the shared clipboard command for dialog use.
docs/features/tui/index.md
Documents elicitation copy labels and the Ctrl+O shortcut.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Copying can alter code or retain invisible escape bytes, while CRLF messages can lose copy labels or trigger quadratic processing for large UTF-8 blocks.
This fast path can copy altered code: - step\n ~~~\n echo hello\n ~~~ produces ho hello because the list parser removes non-whitespace bytes. Nested blockquotes also lose trailing whitespace. Preserve source content with correct container indentation in both parsing paths before exposing copy labels.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Nested quotes with non-ASCII whitespace can freeze the TUI, and unindented fences after list items can lose code; other fence parsing errors also affect rendering and copied text.
This accepts fence characters after intervening whitespace as part of the closing fence. For example, inside a ~~~ block, the valid code line ~~~ ~~~ is treated as the closing delimiter, so the copy label returns only the preceding code and the rest of the message is rendered incorrectly. Only allow additional contiguous fence characters followed by whitespace.
Align fence detection before caching paragraph splits
openingFence recognizes a non-breaking space before a fence, but isBlockStart does not. For intro\n\u00a0~~~\ninside\n~~~\n\nafter, this allows a cached split inside the full parser's open code block, so incremental rendering displays and copies different code. Align paragraph fence detection and boundary classification before caching the split.
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding copy controls to the full TUI. I checked both copy paths, including that Ctrl+O copies the prompt without the form answer.
Prior threads: The short-terminal and wrapped-help cases (4654275845, 4654275857), multiline title offsets (4654275896), longer fences (4654275909), source preservation and control handling (4654275918, 4654685385, 4654685404, 4654685429), Unicode quote prefixes (4655170262), and zero-indent list fences (4655170298) are addressed. Covered tab-bar clicks now reach the dialog, including after dragging; thread 4654275878 is still open on GitHub, but the reported behavior is fixed.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
A subtle mismatch between list-context classification and parser fence handling can truncate code blocks during incremental rendering, requiring human assessment.
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
area/docsDocumentation changesarea/tuiFor features/issues/fixes related to the TUIkind/fixPR fixes a bug (maps to fix:). Use on PRs only.
2 participants
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.
Clicking a fenced-code copy label copies the original, unwrapped code. Press Ctrl+O to copy the entire message as Markdown, without the elicitation answer. Drag selection remains unavailable.
Adds tests for code-label hit testing (including wrapped, scrolled, resized, and moved dialogs), whole-message copying, and help layout.
Validation previously completed: build, full tests, focused race test, vet, and scoped lint passed. Full lint reported three errors in unchanged test files. No live terminal retest was performed.