Просмотр исходного кода

fix: session rename functionality (#3840)

Adi Yeroslav 3 месяцев назад
Родитель
Сommit
9c82f1f5e9
1 измененных файлов с 8 добавлено и 0 удалено
  1. 8 0
      packages/opencode/src/cli/cmd/tui/ui/dialog-prompt.tsx

+ 8 - 0
packages/opencode/src/cli/cmd/tui/ui/dialog-prompt.tsx

@@ -2,6 +2,7 @@ import { TextareaRenderable, TextAttributes } from "@opentui/core"
 import { useTheme } from "../context/theme"
 import { useDialog, type DialogContext } from "./dialog"
 import { onMount } from "solid-js"
+import { useKeyboard } from "@opentui/solid"
 
 export type DialogPromptProps = {
   title: string
@@ -15,6 +16,13 @@ export function DialogPrompt(props: DialogPromptProps) {
   const { theme } = useTheme()
   let textarea: TextareaRenderable
 
+  useKeyboard((evt) => {
+    if (evt.name === "return") {
+      props.onConfirm?.(textarea.plainText)
+      dialog.clear()
+    }
+  })
+
   onMount(() => {
     dialog.setSize("large")
     setTimeout(() => {