Repository navigation
feat(shortcuts): allow adding secondary chords to a shortcut - #4658
Open
CaiJingLong wants to merge 2 commits into
Open
CaiJingLong wants to merge 2 commits into
CaiJingLong wants to merge 2 commits into
Conversation
Each shortcut row only accepted one chord, so binding a second, easier chord meant overwriting the default one. Settings > Shortcuts now offers an add button per row. Secondary chords are stored in the existing custom-binding record as `extra`, expanded into real bindings that carry `extraOf`, and matched by the same dispatcher. They render under their base row and can be re-recorded or removed individually. A secondary chord that a default already occupies disables that default, following the existing custom-binding conflict rule; resetting one scheme keeps the secondary chords.
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7c1c6f5bd9
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
The editor's capture-phase close-tab handler and the SFTP native-paste eligibility check still read only the first binding for their action, so a secondary chord added in Settings matched the global dispatcher but did nothing in those paths. Both now scan every binding for the action.
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.
Problem
Settings → Shortcuts lets you re-record the single chord bound to each action. There is no way to add a second one — recording a new chord overwrites the default, so a user who wants e.g. both
⌘Jand an easier⌘⇧Ofor Quick Switch has to give up the default.Change
CustomKeyBindingsrecords gain an optionalextra: { mac?, pc? }[]. The stored shape stays additive, so older builds ignore the new field and new builds read existing records unchanged; the sync record/version semantics are untouched.resolveKeyBindingsexpands each extra into a realKeyBindingwith id<base>::extra-<n>andextraOfset. The existing dispatcher (checkAppShortcut, the global keydown loop) therefore matches secondary chords with no special casing, and settings keeps rendering one row per action.+button; extra chords render beneath their base row with re-record and remove buttons. "Reset all" clears them; resetting one scheme keeps them. Pattern rows ([1...9], arrows) do not offer the button.Testing
domain/customKeyBindings.test.ts: extra expansion and action resolution, conflict eviction, add / re-record / remove, reset-one-scheme keeps extras, empty override cleanup → 26 pass.AppHandlers.globalHotkeys,AppHandlers.closeTabPane,settingsLocales,localeParityLocales.eslintclean on all changed files.tsc --noEmitin this checkout reports pre-existing errors (unbuilt@netcatty/plugin-contract, strictHostliterals); nothing new in the changed lines. The one error inSettingsShortcutsTab.tsx(SettingsAnchorchildren) is present onmaintoo.Note
I could not attach a screenshot: the settings row layout change would need a running dev build. Happy to add one if you want it before merge.