Skip to content

Commit f202536

Browse files
committed
tui: show enable/disable state in permission toggle and make it searchable by 'toggle permissions'
1 parent 405cc3f commit f202536

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,9 @@ export function Prompt(props: PromptProps) {
159159
command.register(() => {
160160
return [
161161
{
162-
title: "Toggle permissions",
162+
title: autoaccept() ? "Disable permissions" : "Enable permissions",
163163
value: "permission.auto_accept.toggle",
164+
search: "toggle permissions",
164165
keybind: "permission_auto_accept_toggle",
165166
category: "Agent",
166167
onSelect: (dialog) => {

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ export interface DialogSelectOption<T = any> {
3333
title: string
3434
value: T
3535
description?: string
36+
search?: string
3637
footer?: JSX.Element | string
3738
category?: string
3839
disabled?: boolean
@@ -85,8 +86,8 @@ export function DialogSelect<T>(props: DialogSelectProps<T>) {
8586
// users typically search by the item name, and not its category.
8687
const result = fuzzysort
8788
.go(needle, options, {
88-
keys: ["title", "category"],
89-
scoreFn: (r) => r[0].score * 2 + r[1].score,
89+
keys: ["title", "category", "search"],
90+
scoreFn: (r) => r[0].score * 2 + r[1].score + r[2].score,
9091
})
9192
.map((x) => x.obj)
9293

0 commit comments

Comments
 (0)