Skip to content

Commit 102d8e7

Browse files
authored
fix(tui): allow mouse escape via "esc" labels in dialogs (#11421)
1 parent 09a0e92 commit 102d8e7

8 files changed

Lines changed: 26 additions & 8 deletions

File tree

packages/opencode/src/cli/cmd/tui/component/dialog-provider.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,9 @@ function AutoMethod(props: AutoMethodProps) {
154154
<text attributes={TextAttributes.BOLD} fg={theme.text}>
155155
{props.title}
156156
</text>
157-
<text fg={theme.textMuted}>esc</text>
157+
<text fg={theme.textMuted} onMouseUp={() => dialog.clear()}>
158+
esc
159+
</text>
158160
</box>
159161
<box gap={1}>
160162
<Link href={props.authorization.url} fg={theme.primary} />

packages/opencode/src/cli/cmd/tui/component/dialog-status.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { TextAttributes } from "@opentui/core"
22
import { useTheme } from "../context/theme"
3+
import { useDialog } from "@tui/ui/dialog"
34
import { useSync } from "@tui/context/sync"
45
import { For, Match, Switch, Show, createMemo } from "solid-js"
56
import { Installation } from "@/installation"
@@ -9,6 +10,7 @@ export type DialogStatusProps = {}
910
export function DialogStatus() {
1011
const sync = useSync()
1112
const { theme } = useTheme()
13+
const dialog = useDialog()
1214

1315
const enabledFormatters = createMemo(() => sync.data.formatter.filter((f) => f.enabled))
1416

@@ -43,7 +45,9 @@ export function DialogStatus() {
4345
<text fg={theme.text} attributes={TextAttributes.BOLD}>
4446
Status
4547
</text>
46-
<text fg={theme.textMuted}>esc</text>
48+
<text fg={theme.textMuted} onMouseUp={() => dialog.clear()}>
49+
esc
50+
</text>
4751
</box>
4852
<text fg={theme.textMuted}>OpenCode v{Installation.VERSION}</text>
4953
<Show when={Object.keys(sync.data.mcp).length > 0} fallback={<text fg={theme.text}>No MCP Servers</text>}>

packages/opencode/src/cli/cmd/tui/ui/dialog-alert.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ export function DialogAlert(props: DialogAlertProps) {
2525
<text attributes={TextAttributes.BOLD} fg={theme.text}>
2626
{props.title}
2727
</text>
28-
<text fg={theme.textMuted}>esc</text>
28+
<text fg={theme.textMuted} onMouseUp={() => dialog.clear()}>
29+
esc
30+
</text>
2931
</box>
3032
<box paddingBottom={1}>
3133
<text fg={theme.textMuted}>{props.message}</text>

packages/opencode/src/cli/cmd/tui/ui/dialog-confirm.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ export function DialogConfirm(props: DialogConfirmProps) {
3737
<text attributes={TextAttributes.BOLD} fg={theme.text}>
3838
{props.title}
3939
</text>
40-
<text fg={theme.textMuted}>esc</text>
40+
<text fg={theme.textMuted} onMouseUp={() => dialog.clear()}>
41+
esc
42+
</text>
4143
</box>
4244
<box paddingBottom={1}>
4345
<text fg={theme.textMuted}>{props.message}</text>

packages/opencode/src/cli/cmd/tui/ui/dialog-export-options.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,9 @@ export function DialogExportOptions(props: DialogExportOptionsProps) {
8080
<text attributes={TextAttributes.BOLD} fg={theme.text}>
8181
Export Options
8282
</text>
83-
<text fg={theme.textMuted}>esc</text>
83+
<text fg={theme.textMuted} onMouseUp={() => dialog.clear()}>
84+
esc
85+
</text>
8486
</box>
8587
<box gap={1}>
8688
<box>

packages/opencode/src/cli/cmd/tui/ui/dialog-help.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ export function DialogHelp() {
2121
<text attributes={TextAttributes.BOLD} fg={theme.text}>
2222
Help
2323
</text>
24-
<text fg={theme.textMuted}>esc/enter</text>
24+
<text fg={theme.textMuted} onMouseUp={() => dialog.clear()}>
25+
esc/enter
26+
</text>
2527
</box>
2628
<box paddingBottom={1}>
2729
<text fg={theme.textMuted}>

packages/opencode/src/cli/cmd/tui/ui/dialog-prompt.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ export function DialogPrompt(props: DialogPromptProps) {
3939
<text attributes={TextAttributes.BOLD} fg={theme.text}>
4040
{props.title}
4141
</text>
42-
<text fg={theme.textMuted}>esc</text>
42+
<text fg={theme.textMuted} onMouseUp={() => dialog.clear()}>
43+
esc
44+
</text>
4345
</box>
4446
<box gap={1}>
4547
{props.description}

packages/opencode/src/cli/cmd/tui/ui/dialog-select.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,9 @@ export function DialogSelect<T>(props: DialogSelectProps<T>) {
226226
<text fg={theme.text} attributes={TextAttributes.BOLD}>
227227
{props.title}
228228
</text>
229-
<text fg={theme.textMuted}>esc</text>
229+
<text fg={theme.textMuted} onMouseUp={() => dialog.clear()}>
230+
esc
231+
</text>
230232
</box>
231233
<box paddingTop={1}>
232234
<input

0 commit comments

Comments
 (0)