GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Clear terminal history on close and prefer git cwd · pingdotgg/t3code@b26e2d1

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • apps/web/src/components
    • ChatView.tsx
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎apps/web/src/components/ChatView.tsx‎

Copy file name to clipboardExpand all lines: apps/web/src/components/ChatView.tsx
+14-6Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -303,13 +303,21 @@ export default function ChatView() {
303303
(terminalId: string) => {
304304
if (!activeThreadId || !api) return;
305305
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);
309315
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());
311319
} else {
312-
void fallbackExitWrite();
320+
void fallbackClearAndExit();
313321
}
314322
dispatch({
315323
type: "CLOSE_THREAD_TERMINAL",
@@ -1500,7 +1508,7 @@ export default function ChatView() {
15001508
key={activeThread.id}
15011509
api={api}
15021510
threadId={activeThread.id}
1503-
cwd={activeProject.cwd}
1511+
cwd={gitCwd ?? activeProject.cwd}
15041512
height={activeThread.terminalHeight}
15051513
terminalIds={activeThread.terminalIds}
15061514
activeTerminalId={activeThread.activeTerminalId}

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.