tui: show enable/disable state in permission toggle and make it searchable by 'toggle permissions'

pull/12633/head
Dax Raad 2026-02-07 16:57:48 -05:00
parent 405cc3f610
commit f202536b65
2 changed files with 5 additions and 3 deletions

View File

@ -159,8 +159,9 @@ export function Prompt(props: PromptProps) {
command.register(() => { command.register(() => {
return [ return [
{ {
title: "Toggle permissions", title: autoaccept() ? "Disable permissions" : "Enable permissions",
value: "permission.auto_accept.toggle", value: "permission.auto_accept.toggle",
search: "toggle permissions",
keybind: "permission_auto_accept_toggle", keybind: "permission_auto_accept_toggle",
category: "Agent", category: "Agent",
onSelect: (dialog) => { onSelect: (dialog) => {

View File

@ -33,6 +33,7 @@ export interface DialogSelectOption<T = any> {
title: string title: string
value: T value: T
description?: string description?: string
search?: string
footer?: JSX.Element | string footer?: JSX.Element | string
category?: string category?: string
disabled?: boolean disabled?: boolean
@ -85,8 +86,8 @@ export function DialogSelect<T>(props: DialogSelectProps<T>) {
// users typically search by the item name, and not its category. // users typically search by the item name, and not its category.
const result = fuzzysort const result = fuzzysort
.go(needle, options, { .go(needle, options, {
keys: ["title", "category"], keys: ["title", "category", "search"],
scoreFn: (r) => r[0].score * 2 + r[1].score, scoreFn: (r) => r[0].score * 2 + r[1].score + r[2].score,
}) })
.map((x) => x.obj) .map((x) => x.obj)