Stop terminal close from auto-reopening with replayed history
Co-authored-by: codex <[email protected]>
This commit is contained in:
1 parent
85fe41bad0
commit
2cd92ae6f5
3 files changed
+6
-13
No files matched your search
@@ -320,7 +320,7 @@ export default function ChatView() {
|
||||
.catch(() => undefined);
|
||||
if ("close" in api.terminal && typeof api.terminal.close === "function") {
|
||||
void api.terminal
|
||||
.close({ threadId: activeThreadId, terminalId })
|
||||
.close({ threadId: activeThreadId, terminalId, deleteHistory: true })
|
||||
.catch(() => fallbackExitWrite());
|
||||
} else {
|
||||
void fallbackExitWrite();
|
||||
|
||||
@@ -301,13 +301,13 @@ describe("store reducer thread continuity", () => {
|
||||
});
|
||||
|
||||
expect(next.threads[0]?.terminalOpen).toBe(true);
|
||||
expect(next.threads[0]?.terminalIds).toEqual([`${DEFAULT_THREAD_TERMINAL_ID}-next`]);
|
||||
expect(next.threads[0]?.terminalIds).toEqual([DEFAULT_THREAD_TERMINAL_ID]);
|
||||
expect(next.threads[0]?.runningTerminalIds).toEqual([]);
|
||||
expect(next.threads[0]?.activeTerminalId).toBe(`${DEFAULT_THREAD_TERMINAL_ID}-next`);
|
||||
expect(next.threads[0]?.activeTerminalId).toBe(DEFAULT_THREAD_TERMINAL_ID);
|
||||
expect(next.threads[0]?.terminalGroups).toEqual([
|
||||
{
|
||||
id: `group-${DEFAULT_THREAD_TERMINAL_ID}-next`,
|
||||
terminalIds: [`${DEFAULT_THREAD_TERMINAL_ID}-next`],
|
||||
id: `group-${DEFAULT_THREAD_TERMINAL_ID}`,
|
||||
terminalIds: [DEFAULT_THREAD_TERMINAL_ID],
|
||||
},
|
||||
]);
|
||||
});
|
||||
|
||||
@@ -164,13 +164,6 @@ function fallbackGroupId(terminalId: string): string {
|
||||
return `group-${terminalId}`;
|
||||
}
|
||||
|
||||
function replacementTerminalId(closedTerminalId: string): string {
|
||||
const normalizedId = closedTerminalId.trim();
|
||||
return normalizedId === DEFAULT_THREAD_TERMINAL_ID
|
||||
? `${DEFAULT_THREAD_TERMINAL_ID}-next`
|
||||
: DEFAULT_THREAD_TERMINAL_ID;
|
||||
}
|
||||
|
||||
function assignUniqueGroupId(groupId: string, usedGroupIds: Set<string>): string {
|
||||
if (!usedGroupIds.has(groupId)) {
|
||||
usedGroupIds.add(groupId);
|
||||
@@ -276,7 +269,7 @@ function closeThreadTerminal(thread: Thread, terminalId: string): Thread {
|
||||
|
||||
const remainingTerminalIds = thread.terminalIds.filter((id) => id !== terminalId);
|
||||
if (remainingTerminalIds.length === 0) {
|
||||
const nextTerminalId = replacementTerminalId(terminalId);
|
||||
const nextTerminalId = terminalId;
|
||||
const nextTerminalGroupId = fallbackGroupId(nextTerminalId);
|
||||
return normalizeThreadTerminals({
|
||||
...thread,
|
||||
|
||||
Reference in new issue
Block a user