summaryrefslogtreecommitdiffhomepage
path: root/packages
diff options
context:
space:
mode:
authorAdam <[email protected]>2025-12-05 09:49:21 -0600
committerAdam <[email protected]>2025-12-05 10:30:48 -0600
commit87a791fdb9432d457202da85ec5e23e42f91db4d (patch)
treecc49a73a35b44a0dbbb77c6c386af5aba2eea274 /packages
parentada7cca10dd4c5c9fb6aa467e0a12724df2c5e8b (diff)
downloadopencode-87a791fdb9432d457202da85ec5e23e42f91db4d.tar.gz
opencode-87a791fdb9432d457202da85ec5e23e42f91db4d.zip
fix(desktop): new session not selecting tab
Diffstat (limited to 'packages')
-rw-r--r--packages/desktop/src/context/session.tsx37
1 files changed, 23 insertions, 14 deletions
diff --git a/packages/desktop/src/context/session.tsx b/packages/desktop/src/context/session.tsx
index 4e9fe71f8..690653992 100644
--- a/packages/desktop/src/context/session.tsx
+++ b/packages/desktop/src/context/session.tsx
@@ -201,20 +201,14 @@ export const { use: useSession, provider: SessionProvider } = createSimpleContex
sdk.client.pty.create({ body: { title: `Terminal ${store.terminals.all.length + 1}` } }).then((pty) => {
const id = pty.data?.id
if (!id) return
- batch(() => {
- setStore("terminals", "all", [
- ...store.terminals.all,
- {
- id,
- title: pty.data?.title ?? "Terminal",
- // rows: pty.data?.rows ?? 24,
- // cols: pty.data?.cols ?? 80,
- // buffer: "",
- // scrollY: 0,
- },
- ])
- setStore("terminals", "active", id)
- })
+ setStore("terminals", "all", [
+ ...store.terminals.all,
+ {
+ id,
+ title: pty.data?.title ?? "Terminal",
+ },
+ ])
+ setStore("terminals", "active", id)
})
},
update(pty: Partial<LocalPTY> & { id: string }) {
@@ -224,6 +218,21 @@ export const { use: useSession, provider: SessionProvider } = createSimpleContex
body: { title: pty.title, size: pty.cols && pty.rows ? { rows: pty.rows, cols: pty.cols } : undefined },
})
},
+ async clone(id: string) {
+ const index = store.terminals.all.findIndex((x) => x.id === id)
+ const pty = store.terminals.all[index]
+ if (!pty) return
+ const clone = await sdk.client.pty.create({
+ body: {
+ title: pty.title,
+ },
+ })
+ if (!clone.data) return
+ setStore("terminals", "all", index, {
+ ...pty,
+ ...clone.data,
+ })
+ },
open(id: string) {
setStore("terminals", "active", id)
},