(shortcuts): configurable session-nav keybindings; free Ctrl+Arrow - #47
Merged
Conversation
The session-nav arrow shortcut hijacked Ctrl+Left/Right, robbing the terminal of word-jump while editing. Move the default to Ctrl/Cmd+Shift+ Arrow (Shift, not Alt — Ctrl+Alt+Arrow is a common Linux workspace-switch binding) and expose all session-nav bindings as re-bindable in Global Settings. - public/shortcuts.js: single source of truth (DEFAULT_SHORTCUTS, SHORTCUT_DEFS, matchShortcut/normalizeShortcuts/formatBinding/ captureBinding); dual-mode (renderer <script> + require() in tests) - grid-view.js: live appShortcuts + setAppShortcuts; isSessionNavKey/ handleSessionNavKey delegate to the matcher - app.js / terminal-manager.js: grid-toggle goes through matchShortcut; load stored bindings at startup; window._applyShortcuts for live apply - settings-panel.js + style.css: 'Keyboard Shortcuts' section with click-to-capture rebind buttons (global scope), persisted under global.shortcuts, applied without restart - eslint.config.js: register new cross-file globals + dedicated dual-mode block allowing the CJS export footer - test/shortcuts.test.js: 10 unit tests incl. the Ctrl+Arrow regression
…fier Review fixes for PR #47: - MAJOR: the keydown capture listener lived on document and leaked app-wide if the settings viewer was dismissed mid-capture via any path that bypasses closeSettingsViewer (hideAllViewers, sidebar/tab clicks). Move the listeners onto the button element itself; a blur (incl. panel dismissal) cancels capture, and re-opening the viewer discards the old listeners with the replaced DOM — no app-wide keyboard interception is possible. - MINOR: captureBinding now refuses a combo that holds the cross-modifier (Ctrl on mac / Meta elsewhere); matchShortcut rejects such events, so capturing it would have produced an unmatchable binding. - doc: note shortcuts.js load-order dependency in index.html.
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.
Why
The session-nav arrow shortcut was bound to Ctrl/Cmd+Arrow, which hijacked
Ctrl+Left/Right— the terminal word-jump everyone uses while editing. This frees those keys and makes all session-nav shortcuts user-configurable.What
Ctrl+Alt+Arrowis a common Linux workspace-switch binding).Ctrl+Left/Rightword-jump is now free in the terminal.global.shortcuts, applied live (no restart).Ctrl/Cmd+Shift+[ / ]) and grid toggle (Ctrl/Cmd+Shift+G) unchanged as defaults but also rebindable.Ctrl+ArrowCtrl+Shift+ArrowCtrl+Shift+[ / ]Ctrl+Shift+GCtrl+Left/Rightfree ✓How
public/shortcuts.js(new) — single source of truth:DEFAULT_SHORTCUTS,SHORTCUT_DEFS,matchShortcut/normalizeShortcuts/formatBinding/captureBinding. Dual-mode (renderer<script>+require()in tests).grid-view.js— liveappShortcuts+setAppShortcuts;isSessionNavKey/handleSessionNavKeydelegate to the matcher.app.js/terminal-manager.js— grid-toggle viamatchShortcut; load stored bindings at startup;window._applyShortcutsfor live apply.settings-panel.js+style.css— rebind UI.eslint.config.js— register new cross-file globals + dedicated dual-mode block.Tests
test/shortcuts.test.js— 10 unit tests, including the headline regression (bareCtrl+Arrowis not a nav shortcut).task checkgreen (0 errors).🤖 Generated with Claude Code