Skip to content

Commit cbae16d

Browse files
committed
fix: graceful exit with proper terminal cleanup
- Use renderer.destroy() instead of stop() for proper terminal state restoration - Let OpenTUI handle Ctrl+C via built-in exitOnCtrlC - Add onDestroy callback to ensure process exits after cleanup - Fixes cursor visibility and terminal state issues on exit
1 parent 078849d commit cbae16d

1 file changed

Lines changed: 7 additions & 8 deletions

File tree

src/index.tsx

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/usr/bin/env node
2-
console.log("[INDEX MODULE] Loading index.tsx");
32
import { render, useKeyboard, useRenderer } from "@opentui/solid";
43
import { Show, Match, createMemo, onMount, createEffect } from "solid-js";
54
import * as Option from "effect/Option";
@@ -196,14 +195,10 @@ function AppContent() {
196195

197196
// Quit handlers (after modal input handlers)
198197
if (key.name === "q" && !key.ctrl) {
199-
renderer.stop();
200-
process.exit(0);
201-
}
202-
if (key.raw === "\u0003") {
203-
// Ctrl+C
204-
renderer.stop();
205-
process.exit(0);
198+
renderer.destroy();
199+
return;
206200
}
201+
// Note: Ctrl+C is handled by OpenTUI's exitOnCtrlC (default: true)
207202

208203
// Help toggle
209204
if (key.name === "?") {
@@ -705,4 +700,8 @@ render(App, {
705700
consoleOptions: {
706701
backgroundColor: "#1a1b26", // Match the main UI background
707702
},
703+
onDestroy: () => {
704+
// Ensure process exits after renderer cleanup
705+
process.exit(0);
706+
},
708707
});

0 commit comments

Comments
 (0)