Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 36 additions & 6 deletions packages/opencode/src/cli/cmd/tui/routes/session/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1174,7 +1174,7 @@ export function Session() {
<UserMessage
copy={
cm.row()?.kind === "user" && cm.row()?.id === message.id
? { line: cm.row()!.line, col: cm.state().col }
? { line: cm.row()!.line, col: cm.state().col, visual: !!cm.state().visual }
: undefined
}
highlights={cm.highlights().get(message.id) ?? []}
Expand All @@ -1196,7 +1196,7 @@ export function Session() {
</Match>
<Match when={message.role === "assistant"}>
<AssistantMessage
copy={cm.row() ? { ...cm.row()!, col: cm.state().col } : undefined}
copy={cm.row() ? { ...cm.row()!, col: cm.state().col, visual: !!cm.state().visual } : undefined}
highlights={cm.highlights()}
last={lastAssistant()?.id === message.id}
message={message as AssistantMessage}
Expand Down Expand Up @@ -1276,7 +1276,7 @@ function UserMessage(props: {
onMouseUp: () => void
index: number
pending?: string
copy?: { line: number; col: number }
copy?: { line: number; col: number; visual?: boolean }
highlights?: CopyHighlight[]
}) {
const ctx = use()
Expand Down Expand Up @@ -1318,6 +1318,16 @@ function UserMessage(props: {
flexShrink={0}
>
<Show when={props.copy}>
<Show when={!props.copy?.visual}>
<box
position="absolute"
top={(props.copy?.line ?? 0) + 1}
left={0}
width="100%"
height={1}
backgroundColor={RGBA.fromInts(255, 255, 255, 15)}
/>
</Show>
<box position="absolute" top={(props.copy?.line ?? 0) + 1} left={props.copy?.col ?? 0}>
<text fg={theme.text}>█</text>
</box>
Expand Down Expand Up @@ -1387,7 +1397,7 @@ function AssistantMessage(props: {
message: AssistantMessage
parts: Part[]
last: boolean
copy?: CopyRow
copy?: CopyRow & { visual?: boolean }
highlights?: Map<string, CopyHighlight[]>
}) {
const ctx = use()
Expand Down Expand Up @@ -1532,7 +1542,7 @@ function TextPart(props: {
last: boolean
part: TextPart
message: AssistantMessage
copy?: CopyRow
copy?: CopyRow & { visual?: boolean }
highlights?: CopyHighlight[]
}) {
const ctx = use()
Expand All @@ -1541,6 +1551,16 @@ function TextPart(props: {
<Show when={props.part.text.trim()}>
<box id={"text-" + props.part.id} paddingLeft={3} marginTop={1} flexShrink={0}>
<Show when={props.copy?.kind === "text" && props.copy.part === props.part.id}>
<Show when={!props.copy?.visual}>
<box
position="absolute"
top={props.copy?.line ?? 0}
left={0}
width="100%"
height={1}
backgroundColor={RGBA.fromInts(255, 255, 255, 15)}
/>
</Show>
<box position="absolute" top={props.copy?.line ?? 0} left={props.copy?.col ?? 0}>
<text fg={theme.text}>█</text>
</box>
Expand Down Expand Up @@ -1588,7 +1608,7 @@ function ToolPart(props: {
last: boolean
part: ToolPart
message: AssistantMessage
copy?: CopyRow
copy?: CopyRow & { visual?: boolean }
highlights?: CopyHighlight[]
}) {
const ctx = use()
Expand Down Expand Up @@ -1632,6 +1652,16 @@ function ToolPart(props: {
<Show when={!shouldHide()}>
<box id={"tool-" + props.part.id}>
<Show when={props.copy?.kind === "tool" && props.copy.part === props.part.id}>
<Show when={!props.copy?.visual}>
<box
position="absolute"
top={props.copy?.line ?? 0}
left={0}
width="100%"
height={1}
backgroundColor={RGBA.fromInts(255, 255, 255, 15)}
/>
</Show>
<box position="absolute" top={props.copy?.line ?? 0} left={props.copy?.col ?? 0}>
<text fg={theme.text}>█</text>
</box>
Expand Down
Loading