Repository navigation
feat(shortcuts): cycle Cmd/Ctrl+Shift+]/[ within current tab type by default - #1281
Merged
AmethystLiang merged 4 commits intoMay 4, 2026
Merged
Conversation
…default Extract a shared getNextTabWithinActiveType selector into a new tab-type-cycle.ts helper and route both useTerminalShortcuts.ts and ipc-tab-switch.ts through it. Cmd/Ctrl+Shift+]/[ now cycles within the active tab's type (terminal cycles only terminals, editor cycles only editor tabs, browser cycles only browser tabs). Ctrl+PageDown/Up remains the dedicated terminal-only chord (PR stablyai#1094) regardless of focus. useTerminalShortcuts gains optional activeBrowserTabId and onActivateBrowserTab parameters so browser tabs can dispatch through the same path. The default behavior matches VS Code's TerminalContextKeys.focus-gated cycling and Superset's per-scope chord registry referenced in the issue. Adds tab-type-cycle.test.ts covering single-type, mixed-type, and single-tab no-op cases. ipc-tab-switch.test.ts updated to assert same-type cycling under the new selector. Closes stablyai#1100
When the active tab id is not present in the same-type subset (e.g. during hydration when an editor is active and Cmd+Shift+]/[ targets terminals), findIndex returns -1 and the previous modulo math made backward navigation land on the second-to-last tab instead of the last. Branch on the -1 case to return the last tab for direction=-1 and the first tab for direction=+1, so both directions are predictable. Adds a regression test covering 3 terminal tabs with no active match.
Contributor
|
Thx for the PR. Reviewing it and will get it in today's release |
Contributor
|
sorry got delayed on this... tmr! |
Contributor
Author
you tease |
Adds an "all types" variant of the tab cycle chord so users can page through every tab in the active group regardless of type (terminal / editor / browser), complementing the type-scoped Cmd/Ctrl+Shift+[/]. - Wires the chord through the main-window keydown handler, the browser guest shortcut forwarder, and a new ui:switchTabAcrossAllTypes IPC channel - Factors getNextTabAcrossAllTypes alongside getNextTabWithinActiveType and shares the ipc-tab-switch dispatch logic via resolveCycleContext and applyNextTab helpers to avoid drift between the two chords - Narrows useTerminalShortcuts activeTabType to 'terminal' | 'editor' (the hook's unifiedTabs never contains browsers) and drops the unsound TypeCyclableTab cast - Updates ShortcutsPane to list the new chord and expands tests Co-authored-by: Orca <[email protected]>
Contributor
|
Pushed a follow-up commit adding Cmd/Ctrl+Alt+[/] as a companion chord that cycles across every visible tab in the active group regardless of type (terminal / editor / browser) — an escape hatch to the pre-scope "cycle through everything" behavior without needing a settings toggle. Summary of the addition:
|
AmethystLiang
approved these changes
May 4, 2026
AmethystLiang
left a comment
Contributor
There was a problem hiding this comment.
LGTM — tested locally, the new all-types cycle chord works as expected.
Co-authored-by: Orca <[email protected]>
Contributor
|
Thx again! Out in the latest release https://github.com/stablyai/orca/releases/tag/v1.3.34 |
enrick-dev
pushed a commit
to enrick-dev/orca
that referenced
this pull request
Oct 15, 2026
…default (stablyai#1281) * feat(shortcuts): cycle Cmd/Ctrl+Shift+]/[ within current tab type by default Extract a shared getNextTabWithinActiveType selector into a new tab-type-cycle.ts helper and route both useTerminalShortcuts.ts and ipc-tab-switch.ts through it. Cmd/Ctrl+Shift+]/[ now cycles within the active tab's type (terminal cycles only terminals, editor cycles only editor tabs, browser cycles only browser tabs). Ctrl+PageDown/Up remains the dedicated terminal-only chord (PR stablyai#1094) regardless of focus. useTerminalShortcuts gains optional activeBrowserTabId and onActivateBrowserTab parameters so browser tabs can dispatch through the same path. The default behavior matches VS Code's TerminalContextKeys.focus-gated cycling and Superset's per-scope chord registry referenced in the issue. Adds tab-type-cycle.test.ts covering single-type, mixed-type, and single-tab no-op cases. ipc-tab-switch.test.ts updated to assert same-type cycling under the new selector. Closes stablyai#1100 * fix(shortcuts): use direction-aware fallback when active tab is missing When the active tab id is not present in the same-type subset (e.g. during hydration when an editor is active and Cmd+Shift+]/[ targets terminals), findIndex returns -1 and the previous modulo math made backward navigation land on the second-to-last tab instead of the last. Branch on the -1 case to return the last tab for direction=-1 and the first tab for direction=+1, so both directions are predictable. Adds a regression test covering 3 terminal tabs with no active match. * feat(shortcuts): add Cmd/Ctrl+Alt+[/] to cycle across all tab types Adds an "all types" variant of the tab cycle chord so users can page through every tab in the active group regardless of type (terminal / editor / browser), complementing the type-scoped Cmd/Ctrl+Shift+[/]. - Wires the chord through the main-window keydown handler, the browser guest shortcut forwarder, and a new ui:switchTabAcrossAllTypes IPC channel - Factors getNextTabAcrossAllTypes alongside getNextTabWithinActiveType and shares the ipc-tab-switch dispatch logic via resolveCycleContext and applyNextTab helpers to avoid drift between the two chords - Narrows useTerminalShortcuts activeTabType to 'terminal' | 'editor' (the hook's unifiedTabs never contains browsers) and drops the unsound TypeCyclableTab cast - Updates ShortcutsPane to list the new chord and expands tests Co-authored-by: Orca <[email protected]> --------- Co-authored-by: Jinjing <[email protected]> Co-authored-by: Orca <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Makes
Cmd/Ctrl+Shift+]andCmd/Ctrl+Shift+[cycle within the active tab's type by default - terminal-focused chord cycles only terminals, editor-focused cycles only editor tabs, browser-focused cycles only browser tabs. Mirrors VS Code'sCmd+Shift+]mac behavior (gated onTerminalContextKeys.focus) and Superset's per-scope chord pattern referenced in the issue. The dedicatedCtrl+PageDown/Ctrl+PageUpchord shipped in #1094 stays terminal-only regardless of focus.The cycling logic is extracted into a shared
getNextTabWithinActiveTypehelper atsrc/renderer/src/components/terminal/tab-type-cycle.tsso bothuseTerminalShortcuts.ts(the in-pane chord) andipc-tab-switch.ts(the broader IPC chord path) can route through one selector.useTerminalShortcutsgains optionalactiveBrowserTabIdandonActivateBrowserTabparameters so browser tabs participate in the same path. When the active tab id is missing from the same-type subset (e.g. hydration race when an editor is active and the chord targets terminals), the helper falls back direction-aware: forward yields the first tab, backward yields the last. Browser-tab activation under the IPC path now also callsactivateTab(next.tabId)so split-pane browser layouts re-render to the cycled tab, matching the editor branch.Screenshots
No visual change to render. The behavior change is keyboard-handler logic: which tab gets focus on chord press.
Testing
pnpm lint(oxlint, 0 warnings, 0 errors)pnpm typecheck(typecheckcovers node + cli + web tsc)pnpm test src/renderer(1269 / 1269 passed; newtab-type-cycle.test.tscovers single-type cycling, mixed-type no-op, single-tab no-op, group-tab disambiguation, and direction-aware fallback when the active id is stale)pnpm buildis unrelated to renderer logic and was not exercised here;pnpm testoutside the renderer fails on this branch the same way it fails onmain(better-sqlite3 ABI mismatch in main-process orchestration tests)TypeCyclableTabshapes with mixed types and assert the exact returned tab, not implementation internalsAI Review Report
Reviewed in two passes against the existing chord and IPC paths:
event.code === 'BracketRight' / 'BracketLeft'which is platform-symmetric (mac, Linux, Windows produce the same code on the same physical key). Confirmed by inspecting the existing in-sourceWhy:comment that already explained this. No new platform branches added.Ctrl+PageDown/Ctrl+PageUp, terminal-only viahandleSwitchTerminalTabfrom PR feat(shortcuts): add Ctrl+PageDown/Up to cycle terminal tabs only #1094) is dispatched separately and untouched. Confirmed by reading both branches inipc-tab-switch.tsafter the change.findIndexreturns -1 (active id missing from the same-type subset), backward navigation on 3+ same-type tabs landed on the second-to-last tab instead of the last. Fixed with a direction-aware fallback: -1 returns the last tab, +1 returns the first. New test added.setActiveBrowserTab(next.id)while the editor branch called bothsetActiveFileandactivateTab(next.tabId). The split pane is rendered from the owning group'sactiveTabId, so without theactivateTabcall the visible pane could fail to re-render to the cycled tab. Brought the browser branch in line with the editor branch.Security Audit
No security-relevant surfaces. The change is renderer-only keyboard event handling and tab-state cycling. No input handling, command execution, path resolution, auth, secrets, or IPC privilege boundaries touched. Browser-tab cycling already runs inside the existing same-origin Electron renderer; no new cross-origin or sandbox boundary work.
Notes
The default-flip is the issue's recommended approach (the alternatives section explicitly rejects a
tabCycleScopesetting). If a maintainer prefers an opt-in instead, the helper's signature is already well-isolated for that variant: gate the call on a settings boolean and fall back to the previous cross-type rotation when off. Happy to repackage.Closes #1100