The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 25, 19:45 UTC
Clear terminal history on close and prefer git cwd
- Pass `deleteHistory: true` when closing a terminal - Fallback path now clears terminal before sending `exit` - Use `gitCwd` as terminal cwd when available
Julius Marminge committed
Feb 12, 2026 at 21:22 UTC
b26e2d192e6923cd2e46e863360fe3d1e78e5c34
1 file changed
+14
-6
apps/web/src/components/ChatView.tsx
+14
-6
@@ -303,13 +303,21 @@ export default function ChatView() {
303
(terminalId: string) => {
304
if (!activeThreadId || !api) return;
305
const fallbackExitWrite = () =>
306
- api.terminal.write({ threadId: activeThreadId, terminalId, data: "exit\n" }).catch(() => {
307
- // Ignore write errors so the UI can still close an uninitialized or already-exited terminal.
308
- });
306
+ api.terminal
307
+ .write({ threadId: activeThreadId, terminalId, data: "exit\n" })
308
+ .catch(() => undefined);
309
+ const fallbackClearAndExit = () =>
310
+ api.terminal
311
+ .clear({ threadId: activeThreadId, terminalId })
312
+ .catch(() => undefined)
313
+ .then(() => fallbackExitWrite())
314
+ .catch(() => undefined);
315
if ("close" in api.terminal && typeof api.terminal.close === "function") {
310
- void api.terminal.close({ threadId: activeThreadId, terminalId }).catch(() => fallbackExitWrite());
316
+ void api.terminal
317
+ .close({ threadId: activeThreadId, terminalId, deleteHistory: true })
318
+ .catch(() => fallbackClearAndExit());
319
} else {
312
- void fallbackExitWrite();
320
+ void fallbackClearAndExit();
321
}
322
dispatch({
323
type: "CLOSE_THREAD_TERMINAL",
@@ -1500,7 +1508,7 @@ export default function ChatView() {
1508
key={activeThread.id}
1509
api={api}
1510
threadId={activeThread.id}
1503
- cwd={activeProject.cwd}
1511
+ cwd={gitCwd ?? activeProject.cwd}
1512
height={activeThread.terminalHeight}
1513
terminalIds={activeThread.terminalIds}
1514
activeTerminalId={activeThread.activeTerminalId}