summaryrefslogtreecommitdiffhomepage
path: root/packages/app/src/context
diff options
context:
space:
mode:
Diffstat (limited to 'packages/app/src/context')
-rw-r--r--packages/app/src/context/terminal.tsx15
1 files changed, 15 insertions, 0 deletions
diff --git a/packages/app/src/context/terminal.tsx b/packages/app/src/context/terminal.tsx
index 709d7b899..6f92b4adf 100644
--- a/packages/app/src/context/terminal.tsx
+++ b/packages/app/src/context/terminal.tsx
@@ -38,6 +38,21 @@ function createTerminalSession(sdk: ReturnType<typeof useSDK>, dir: string, sess
}),
)
+ sdk.event.on("pty.exited", (event) => {
+ const id = event.properties.id
+ if (!store.all.some((x) => x.id === id)) return
+ batch(() => {
+ setStore(
+ "all",
+ store.all.filter((x) => x.id !== id),
+ )
+ if (store.active === id) {
+ const remaining = store.all.filter((x) => x.id !== id)
+ setStore("active", remaining[0]?.id)
+ }
+ })
+ })
+
return {
ready,
all: createMemo(() => Object.values(store.all)),