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

fix(tui): allow exit when viewing child session (#6898)

Co-authored-by: Aiden Cline <[email protected]>
Rafi Khardalian 1 месяц назад
Родитель
Сommit
7324b2260a
1 измененных файлов с 10 добавлено и 0 удалено
  1. 10 0
      packages/opencode/src/cli/cmd/tui/routes/session/index.tsx

+ 10 - 0
packages/opencode/src/cli/cmd/tui/routes/session/index.tsx

@@ -65,6 +65,7 @@ import { Editor } from "../../util/editor"
 import stripAnsi from "strip-ansi"
 import { Footer } from "./footer.tsx"
 import { usePromptRef } from "../../context/prompt"
+import { useExit } from "../../context/exit"
 import { Filesystem } from "@/util/filesystem"
 import { PermissionPrompt } from "./permission"
 import { DialogExportOptions } from "../../ui/dialog-export-options"
@@ -191,6 +192,15 @@ export function Session() {
   let prompt: PromptRef
   const keybind = useKeybind()
 
+  // Allow exit when in child session (prompt is hidden)
+  const exit = useExit()
+  useKeyboard((evt) => {
+    if (!session()?.parentID) return
+    if (keybind.match("app_exit", evt)) {
+      exit()
+    }
+  })
+
   // Helper: Find next visible message boundary in direction
   const findNextVisibleMessage = (direction: "next" | "prev"): string | null => {
     const children = scroll.getChildren()