Skip to content

Commit ac244b1

Browse files
committed
tui: add searchable 'toggle' keywords to command palette and show current state in toggle titles
1 parent f202536 commit ac244b1

3 files changed

Lines changed: 16 additions & 2 deletions

File tree

packages/opencode/src/cli/cmd/tui/app.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,7 @@ function App() {
415415
{
416416
title: "Toggle MCPs",
417417
value: "mcp.list",
418+
search: "toggle mcps",
418419
category: "Agent",
419420
slash: {
420421
name: "mcps",
@@ -490,8 +491,9 @@ function App() {
490491
category: "System",
491492
},
492493
{
493-
title: "Toggle appearance",
494+
title: mode() === "dark" ? "Light mode" : "Dark mode",
494495
value: "theme.switch_mode",
496+
search: "toggle appearance",
495497
onSelect: (dialog) => {
496498
setMode(mode() === "dark" ? "light" : "dark")
497499
dialog.clear()
@@ -530,6 +532,7 @@ function App() {
530532
},
531533
{
532534
title: "Toggle debug panel",
535+
search: "toggle debug",
533536
category: "System",
534537
value: "app.debug",
535538
onSelect: (dialog) => {
@@ -539,6 +542,7 @@ function App() {
539542
},
540543
{
541544
title: "Toggle console",
545+
search: "toggle console",
542546
category: "System",
543547
value: "app.console",
544548
onSelect: (dialog) => {
@@ -579,6 +583,7 @@ function App() {
579583
{
580584
title: terminalTitleEnabled() ? "Disable terminal title" : "Enable terminal title",
581585
value: "terminal.title.toggle",
586+
search: "toggle terminal title",
582587
keybind: "terminal_title_toggle",
583588
category: "System",
584589
onSelect: (dialog) => {
@@ -594,6 +599,7 @@ function App() {
594599
{
595600
title: kv.get("animations_enabled", true) ? "Disable animations" : "Enable animations",
596601
value: "app.toggle.animations",
602+
search: "toggle animations",
597603
category: "System",
598604
onSelect: (dialog) => {
599605
kv.set("animations_enabled", !kv.get("animations_enabled", true))
@@ -603,6 +609,7 @@ function App() {
603609
{
604610
title: kv.get("diff_wrap_mode", "word") === "word" ? "Disable diff wrapping" : "Enable diff wrapping",
605611
value: "app.toggle.diffwrap",
612+
search: "toggle diff wrapping",
606613
category: "System",
607614
onSelect: (dialog) => {
608615
const current = kv.get("diff_wrap_mode", "word")

packages/opencode/src/cli/cmd/tui/routes/home.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ export function Home() {
4646
{
4747
title: tipsHidden() ? "Show tips" : "Hide tips",
4848
value: "tips.toggle",
49+
search: "toggle tips",
4950
keybind: "tips_toggle",
5051
category: "System",
5152
onSelect: (dialog) => {

packages/opencode/src/cli/cmd/tui/routes/session/index.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,7 @@ export function Session() {
509509
{
510510
title: sidebarVisible() ? "Hide sidebar" : "Show sidebar",
511511
value: "session.sidebar.toggle",
512+
search: "toggle sidebar",
512513
keybind: "sidebar_toggle",
513514
category: "Session",
514515
onSelect: (dialog) => {
@@ -523,6 +524,7 @@ export function Session() {
523524
{
524525
title: conceal() ? "Disable code concealment" : "Enable code concealment",
525526
value: "session.toggle.conceal",
527+
search: "toggle code concealment",
526528
keybind: "messages_toggle_conceal" as any,
527529
category: "Session",
528530
onSelect: (dialog) => {
@@ -533,6 +535,7 @@ export function Session() {
533535
{
534536
title: showTimestamps() ? "Hide timestamps" : "Show timestamps",
535537
value: "session.toggle.timestamps",
538+
search: "toggle timestamps",
536539
category: "Session",
537540
slash: {
538541
name: "timestamps",
@@ -546,6 +549,7 @@ export function Session() {
546549
{
547550
title: showThinking() ? "Hide thinking" : "Show thinking",
548551
value: "session.toggle.thinking",
552+
search: "toggle thinking",
549553
keybind: "display_thinking",
550554
category: "Session",
551555
slash: {
@@ -560,6 +564,7 @@ export function Session() {
560564
{
561565
title: showDetails() ? "Hide tool details" : "Show tool details",
562566
value: "session.toggle.actions",
567+
search: "toggle tool details",
563568
keybind: "tool_details",
564569
category: "Session",
565570
onSelect: (dialog) => {
@@ -568,8 +573,9 @@ export function Session() {
568573
},
569574
},
570575
{
571-
title: "Toggle session scrollbar",
576+
title: showScrollbar() ? "Hide session scrollbar" : "Show session scrollbar",
572577
value: "session.toggle.scrollbar",
578+
search: "toggle session scrollbar",
573579
keybind: "scrollbar_toggle",
574580
category: "Session",
575581
onSelect: (dialog) => {

0 commit comments

Comments
 (0)