Browse Source

tui: improve keyboard navigation and MCP server status display

Dax Raad 3 months ago
parent
commit
9beb0f8512

+ 1 - 1
packages/opencode/src/cli/cmd/tui/component/dialog-command.tsx

@@ -78,7 +78,7 @@ export function CommandProvider(props: ParentProps) {
   const keybind = useKeybind()
 
   useKeyboard((evt) => {
-    if (keybind.match("command_list", evt)) {
+    if (keybind.match("command_list", evt) && dialog.stack.length === 0) {
       evt.preventDefault()
       dialog.replace(() => <DialogCommand options={value.options} />)
       return

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

@@ -15,7 +15,7 @@ export function DialogStatus() {
         <text attributes={TextAttributes.BOLD}>Status</text>
         <text fg={theme.textMuted}>esc</text>
       </box>
-      <Show when={Object.keys(sync.data.mcp).length > 0}>
+      <Show when={Object.keys(sync.data.mcp).length > 0} fallback={<text>No MCP Servers</text>}>
         <box>
           <text>{Object.keys(sync.data.mcp).length} MCP Servers</text>
           <For each={Object.entries(sync.data.mcp)}>

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

@@ -123,8 +123,8 @@ export function DialogSelect<T>(props: DialogSelectProps<T>) {
 
   const keybind = useKeybind()
   useKeyboard((evt) => {
-    if (evt.name === "up") move(-1)
-    if (evt.name === "down") move(1)
+    if (evt.name === "up" || (evt.ctrl && evt.name === "p")) move(-1)
+    if (evt.name === "down" || (evt.ctrl && evt.name === "n")) move(1)
     if (evt.name === "pageup") move(-10)
     if (evt.name === "pagedown") move(10)
     if (evt.name === "return") {