Просмотр исходного кода

feat(tui): default tabs to cwd scope

Dax Raad 2 недель назад
Родитель
Сommit
4bd16d6f47

+ 8 - 0
packages/tui/src/component/dialog-config.tsx

@@ -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",

+ 2 - 2
packages/tui/src/context/session-tabs.tsx

@@ -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(
         () => {},
       )