From 76e9271dce73c3c935001ff799152ad2cc91441d Mon Sep 17 00:00:00 2001 From: alt-glitch Date: Tue, 9 Jun 2026 07:19:39 +0000 Subject: [PATCH] opentui(copy): theme the selection highlight MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Apply the existing theme selectionBg token to the plain content renderables (TextBufferRenderable supports selectionBg/selectionFg) so a selection draws a clean solid bar that PRESERVES the text fg (no selectionFg → no SGR-inverse fragmenting). Applied to: - messageLine: the flat settled/user/system message text. - toolPart: the args value lines + the output body lines. Limitation: assistant answers rendered via the native renderable (MarkdownRenderable extends Renderable, not TextBufferRenderable, and MarkdownOptions has no selectionBg/selectionFg) cannot take the themed highlight — they fall back to the renderer's default selection style. --- ui-tui-opentui-v2/src/view/messageLine.tsx | 5 ++++- ui-tui-opentui-v2/src/view/toolPart.tsx | 8 +++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/ui-tui-opentui-v2/src/view/messageLine.tsx b/ui-tui-opentui-v2/src/view/messageLine.tsx index 0fa345506e8..612f2b92706 100644 --- a/ui-tui-opentui-v2/src/view/messageLine.tsx +++ b/ui-tui-opentui-v2/src/view/messageLine.tsx @@ -56,7 +56,10 @@ export function MessageLine(props: { message: Message }) { + // themed selection: a solid muted/accent bar that preserves the + // text fg (no selectionFg → the original color shows through, so a + // highlight over content reads as a clean bar, not SGR-inverse). + {m().text} } diff --git a/ui-tui-opentui-v2/src/view/toolPart.tsx b/ui-tui-opentui-v2/src/view/toolPart.tsx index 6f44d1b25b3..5dc1a4c4d6f 100644 --- a/ui-tui-opentui-v2/src/view/toolPart.tsx +++ b/ui-tui-opentui-v2/src/view/toolPart.tsx @@ -148,7 +148,7 @@ export function ToolPart(props: { part: ToolPartState }) { fallback={ {line => ( - + {truncate(line, bodyWidth() - 2)} )} @@ -157,7 +157,7 @@ export function ToolPart(props: { part: ToolPartState }) { > {([k, v]) => ( - + {truncate(argLine(k, v), bodyWidth() - 2)} )} @@ -176,9 +176,11 @@ export function ToolPart(props: { part: ToolPartState }) { output + {/* output body lines are the copyable content → themed selection bar + (preserves fg; same token as message text) (item: theme highlight). */} {line => ( - + {line} )}