feat: when closing a tab, go to previous tab (MRU) not nearest neighbor (#784)

This commit is contained in:
Neil
2026-04-17 19:43:22 -07:00
committed by GitHub
parent 8d3494fe07
commit 8dbfec4e20
11 changed files with 372 additions and 26 deletions
+7
View File
@@ -99,6 +99,13 @@ export type TabGroup = {
worktreeId: string
activeTabId: string | null
tabOrder: string[] // canonical visual order of tab IDs
/** Per-group MRU stack (oldest → most-recent at the tail). Drives which tab
* becomes active when the current active tab closes: we pop back to the
* previously-active tab instead of jumping to a visual neighbor. Scoped to
* the group so split panes keep independent histories. Optional because
* sessions persisted before this field was added still hydrate cleanly —
* hydration seeds from activeTabId. */
recentTabIds?: string[]
}
// ─── Terminal Tab (legacy — used by persistence and TerminalContentSlice) ─
+2 -1
View File
@@ -87,7 +87,8 @@ const tabGroupSchema = z.object({
id: z.string(),
worktreeId: z.string(),
activeTabId: z.string().nullable(),
tabOrder: z.array(z.string())
tabOrder: z.array(z.string()),
recentTabIds: z.array(z.string()).optional()
})
const tabGroupSplitDirectionSchema = z.enum(['horizontal', 'vertical'])