| ... | ... | @@ -303,13 +303,21 @@ export default function ChatView() { |
| 303 | 303 | (terminalId: string) => { |
| 304 | 304 | if (!activeThreadId || !api) return; |
| 305 | 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); |
| 309 | 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()); |
| 311 | 319 | } else { |
| 312 | | void fallbackExitWrite(); |
| 320 | void fallbackClearAndExit(); |
| 313 | 321 | } |
| 314 | 322 | dispatch({ |
| 315 | 323 | type: "CLOSE_THREAD_TERMINAL", |
| ... | ... | @@ -1500,7 +1508,7 @@ export default function ChatView() { |
| 1500 | 1508 | key={activeThread.id} |
| 1501 | 1509 | api={api} |
| 1502 | 1510 | threadId={activeThread.id} |
| 1503 | | cwd={activeProject.cwd} |
| 1511 | cwd={gitCwd ?? activeProject.cwd} |
| 1504 | 1512 | height={activeThread.terminalHeight} |
| 1505 | 1513 | terminalIds={activeThread.terminalIds} |
| 1506 | 1514 | activeTerminalId={activeThread.activeTerminalId} |