Fix split view keybindings treating tab objects as IDs
SplitView.tabs is Browser.Tabs.Tab[], not number[]. The C-h/C-l
handlers passed tab objects directly to browser.tabs.update() and
used indexOf() to compare numbers against objects. C-j/C-k built
a Set of objects instead of IDs, so the split-sibling check never
matched.

Assisted-by: Claude Opus 4.6 via pi
change nskokzpzypyrnnoxqsyxozontwstrytk
commit d70dc0d3cdbc33114a2236f3c6bfeedf660662cd
author Alpha Chen <alpha@kejadlen.dev>
date
parent vtpzuoyu
diff --git a/.config/glide/unstable.glide.ts b/.config/glide/unstable.glide.ts
index 499fa31a..bea40b52 100644
--- a/.config/glide/unstable.glide.ts
+++ b/.config/glide/unstable.glide.ts
@@ -18,10 +18,10 @@ glide.keymaps.set(
   async ({ tab_id }) => {
     const split = glide.unstable.split_views.get(tab_id);
     if (!split) return;
-    const index = split.tabs.indexOf(tab_id);
+    const index = split.tabs.findIndex((t) => t.id === tab_id);
     const target = split.tabs.at((index - 1) % split.tabs.length);
-    if (target == null) return;
-    await browser.tabs.update(target, { active: true });
+    if (target?.id == null) return;
+    await browser.tabs.update(target.id, { active: true });
   },
   {
     description: "Focus the split to the left",
@@ -34,10 +34,10 @@ glide.keymaps.set(
   async ({ tab_id }) => {
     const split = glide.unstable.split_views.get(tab_id);
     if (!split) return;
-    const index = split.tabs.indexOf(tab_id);
+    const index = split.tabs.findIndex((t) => t.id === tab_id);
     const target = split.tabs.at((index + 1) % split.tabs.length);
-    if (target == null) return;
-    await browser.tabs.update(target, { active: true });
+    if (target?.id == null) return;
+    await browser.tabs.update(target.id, { active: true });
   },
   {
     description: "Focus the split to the right",
@@ -53,7 +53,7 @@ glide.keymaps.set(
       await glide.excmds.execute("tab_next");
       return;
     }
-    const splitIds = new Set(split.tabs);
+    const splitIds = new Set(split.tabs.map((t) => t.id));
     const all_tabs = await glide.tabs.query({});
     const currentIndex = all_tabs.findIndex((t) => t.id === tab_id);
     for (let i = 1; i < all_tabs.length; i++) {
@@ -76,7 +76,7 @@ glide.keymaps.set(
       await glide.excmds.execute("tab_prev");
       return;
     }
-    const splitIds = new Set(split.tabs);
+    const splitIds = new Set(split.tabs.map((t) => t.id));
     const all_tabs = await glide.tabs.query({});
     const currentIndex = all_tabs.findIndex((t) => t.id === tab_id);
     for (let i = 1; i < all_tabs.length; i++) {