Skip to content

Commit e8dd8f7

Browse files
simonkleekommander
andauthored
tui(run): use keymap instead of raw key events (anomalyco#30077)
Co-authored-by: Sebastian Herrlinger <hasta84@gmail.com>
1 parent a291967 commit e8dd8f7

19 files changed

Lines changed: 762 additions & 893 deletions

bun.lock

Lines changed: 15 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@
3838
"@types/cross-spawn": "6.0.6",
3939
"@octokit/rest": "22.0.0",
4040
"@hono/zod-validator": "0.4.2",
41-
"@opentui/core": "0.2.16",
42-
"@opentui/keymap": "0.2.16",
43-
"@opentui/solid": "0.2.16",
41+
"@opentui/core": "0.3.0",
42+
"@opentui/keymap": "0.3.0",
43+
"@opentui/solid": "0.3.0",
4444
"ulid": "3.0.1",
4545
"@kobalte/core": "0.13.11",
4646
"@types/luxon": "3.7.1",

packages/opencode/src/cli/cmd/run/footer.command.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@ import { useKeyboard, type JSX } from "@opentui/solid"
44
import fuzzysort from "fuzzysort"
55
import { createEffect, createMemo, createSignal, type Accessor } from "solid-js"
66
import { RunFooterMenu, createFooterMenuState, type RunFooterMenuItem } from "./footer.menu"
7-
import { formatBindings } from "./keymap.shared"
87
import type { RunFooterTheme } from "./theme"
9-
import type { FooterKeybinds, FooterSubagentTab, RunCommand, RunInput, RunProvider } from "./types"
8+
import type { FooterSubagentTab, RunCommand, RunInput, RunProvider } from "./types"
109

1110
type PanelEntry = RunFooterMenuItem & {
1211
category: string
@@ -296,7 +295,7 @@ export function RunCommandMenuBody(props: {
296295
commands: Accessor<RunCommand[] | undefined>
297296
subagents: Accessor<FooterSubagentTab[]>
298297
variants: Accessor<string[]>
299-
keybinds: FooterKeybinds
298+
variantCycle: string
300299
onClose: () => void
301300
onModel: () => void
302301
onSubagent: () => void
@@ -334,7 +333,7 @@ export function RunCommandMenuBody(props: {
334333
action: "variant.cycle",
335334
category: "Suggested",
336335
display: "Variant cycle",
337-
footer: formatBindings(props.keybinds.variantCycle, props.keybinds.leader),
336+
footer: props.variantCycle,
338337
keywords: "variant cycle",
339338
},
340339
...(props.variants().length > 0

packages/opencode/src/cli/cmd/run/footer.permission.tsx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ function buttons(
6464
)
6565
}
6666

67-
function RejectField(props: {
67+
/** @internal Exported to test managed textarea submission without permission navigation. */
68+
export function RejectField(props: {
6869
theme: RunFooterTheme
6970
text: string
7071
disabled: boolean
@@ -107,6 +108,7 @@ function RejectField(props: {
107108
focusedBackgroundColor={props.theme.surface}
108109
cursorColor={props.theme.text}
109110
focused={!props.disabled}
111+
onSubmit={props.onConfirm}
110112
onContentChange={() => {
111113
if (!area || area.isDestroyed) {
112114
return
@@ -119,11 +121,6 @@ function RejectField(props: {
119121
props.onCancel()
120122
return
121123
}
122-
123-
if (event.name === "return" && !event.meta && !event.ctrl && !event.shift) {
124-
event.preventDefault()
125-
props.onConfirm()
126-
}
127124
}}
128125
ref={(item) => {
129126
area = item

0 commit comments

Comments
 (0)