feat(tui): default tabs to cwd scope

This commit is contained in:
Dax Raad 2026-07-29 12:35:23 -04:00
commit 4bd16d6f47
2 changed files with 10 additions and 2 deletions

View file

@ -101,6 +101,14 @@ export const settings: Setting[] = [
values: [false, true],
labels: ["off", "on"],
},
{
title: "Scope",
category: "Tabs",
path: ["tabs", "scope"],
default: "cwd",
values: ["cwd", "global"],
labels: ["current directory", "global"],
},
{
title: "Layout",
category: "Diffs",

View file

@ -49,12 +49,12 @@ export const { use: useSessionTabs, provider: SessionTabsProvider } = createSimp
let history: SessionTabHistory = { entries: [], index: -1 }
function state() {
if (config.tabs?.scope !== "cwd") return store.global
if (config.tabs?.scope === "global") return store.global
return store.cwd[paths.cwd] ?? fallback
}
function update(mutation: (draft: TabsState) => void) {
const scope = config.tabs?.scope ?? "global"
const scope = config.tabs?.scope ?? "cwd"
void updateStore((draft) => mutation(scope === "cwd" ? (draft.cwd[paths.cwd] ??= empty()) : draft.global)).catch(
() => {},
)