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

tui: added ctrl-z terminal suspension support (#3983)

Goni Zahavy 3 месяцев назад
Родитель
Сommit
6afdb5c0e5

+ 15 - 0
packages/opencode/src/cli/cmd/tui/app.tsx

@@ -342,6 +342,21 @@ function App() {
         dialog.clear()
       },
     },
+    {
+      title: "Suspend terminal",
+      value: "terminal.suspend",
+      keybind: "terminal_suspend",
+      category: "System",
+      onSelect: () => {
+        process.once("SIGCONT", () => {
+          renderer.resume()
+        })
+
+        renderer.suspend()
+        // pid=0 means send the signal to all processes in the process group
+        process.kill(0, "SIGTSTP")
+      },
+    },
   ])
 
   createEffect(() => {

+ 1 - 0
packages/opencode/src/config/config.ts

@@ -430,6 +430,7 @@ export namespace Config {
       history_next: z.string().optional().default("down").describe("Next history item"),
       session_child_cycle: z.string().optional().default("<leader>right").describe("Next child session"),
       session_child_cycle_reverse: z.string().optional().default("<leader>left").describe("Previous child session"),
+      terminal_suspend: z.string().optional().default("ctrl+z").describe("Suspend terminal"),
     })
     .strict()
     .meta({

+ 4 - 0
packages/sdk/js/src/gen/types.gen.ts

@@ -846,6 +846,10 @@ export type KeybindsConfig = {
    * Previous child session
    */
   session_child_cycle_reverse?: string
+  /**
+   * Suspend terminal
+   */
+  terminal_suspend?: string
 }
 
 export type AgentConfig = {