Repository navigation
feat(shortcuts): expand keyboard shortcuts and group the Shortcuts menu - #467
Open
Dhruv-Sharma29 wants to merge 1 commit into
Open
Dhruv-Sharma29 wants to merge 1 commit into
Dhruv-Sharma29 wants to merge 1 commit into
Conversation
- Add working shortcuts for Open Folder, Strikethrough, Inline Code, Insert Link, Toggle Focus Mode, Toggle Preview Panel, font size up and down, and next/previous tab. - Add the new commands to the Format and View menus, and rename "Show Preview Panel" to "Toggle Preview Panel" to match what it does. - Move the shortcut table into shortcut-definitions.mjs. The key handler and the Shortcuts menu still read the same table; plain JS lets the Node 20 test suite check the real bindings. - Group the Shortcuts menu by category with separators. - Test both platforms for duplicate chords, reserved system/clipboard chords, missing labels, and split categories. - Update docs/KeyboardShortcuts.md. Closes petertzy#458
This branch has not been deployed
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.
Closes #458
Review of existing shortcuts
DEFAULT_SHORTCUTS) already drives both the key handler and the Shortcuts menu, so no listed shortcut was missing an implementation.New shortcuts (all working, not just listed)
The new commands also appear in the Format and View menus.
Single source of truth and tests
keyboardShortcuts.tsintolib/shortcut-definitions.mjs.keyboardShortcuts.tsre-exports it asDEFAULT_SHORTCUTS, so existing callers are unchanged..ts. That is why the existingkeyboard-shortcuts.test.mjscopies the logic instead of importing it. As plain JS, the real table can be tested on both platforms.tests/shortcut-definitions.test.mjschecks, for both macOS and Windows/Linux:,, the clipboard/select-all chords, or Alt+F4;docs/KeyboardShortcuts.mdis updated.Trade-offs worth a look
Cmd+K …chords (such as toggling a block comment) and macOS's Cmd+E "find with selection". Insert Link and Inline Code seemed more useful in a Markdown editor. Happy to pick other keys.Testing
npm test(171 pass),npx tsc --noEmit,npm run lint,npm run buildall pass.