feat(keybind): cycle tabs and switch channel with pill sync

This commit is contained in:
2026-06-16 01:21:05 +02:00
parent 88491902eb
commit 3878869904
3 changed files with 55 additions and 5 deletions
+19
View File
@@ -160,6 +160,25 @@ internal sealed class MainWindow : Window
TabLifecycleHelpers.OnTabActivated(tab, previous);
}
// Tab-cycle entry point for the ChatTabForward/Backward keybinds. Empty list is a
// no-op; a null active tab seeds tabs[0]; a single-tab cycle that lands on the
// already-active tab is a no-op (ActivateTab early-returns on the same reference).
// Routes through ActivateTab so the cycle strips stale tell state + re-derives the
// channel exactly like a sidebar/top-tab click. Pop-out focus-forward stays
// deferred (no focus contract) — main-window tabs only.
internal void ChangeTabDelta(int delta)
{
var tabs = Plugin.Config.Tabs;
if (tabs.Count == 0)
return;
var idx = _activeTab is null ? 0 : tabs.IndexOf(_activeTab);
if (idx < 0)
idx = 0; // active tab not in the list (mid-strip) -> start from the first
ActivateTab(tabs[TabLifecycleHelpers.WrapTabIndex(idx, delta, tabs.Count)]);
}
// Internal accessors for self-tests so the probes can reach the live
// component without exposing them as public surface.
internal Components.Sidebar GetSidebarForSelfTest() => _sidebar;