fix: capitalize accelerator modifiers to fix custom keybindings#4134
Open
Bowl42 wants to merge 2 commits intomarktext:developfrom
Open
fix: capitalize accelerator modifiers to fix custom keybindings#4134Bowl42 wants to merge 2 commits intomarktext:developfrom
Bowl42 wants to merge 2 commits intomarktext:developfrom
Conversation
…text#4123) The keybinding UI captured keyboard shortcuts with lowercase modifier names (e.g. "ctrl+alt+1") via getAcceleratorFromKeyboardEvent(), but Electron requires properly capitalized modifiers (e.g. "Ctrl+Alt+1"). - Add capitalizeAccelerator() utility to normalize modifier casing - Apply capitalization in key-input-dialog before saving - Fix _isDefaultBinding to use case-insensitive comparison - Add comprehensive unit tests for capitalizeAccelerator Fixes marktext#4123 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Apply capitalizeAccelerator when loading user keybindings from disk, healing legacy files that contain lowercase modifiers - Fix JSDoc: clarify that only modifiers are capitalized, not key names - Fix comment: map contains modifier names only - Add missing test cases: single modifier without key, Plus key, non-modifier special keys, idempotency Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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
Fixes #4123
getAcceleratorFromKeyboardEvent()which returns lowercase modifier names (e.g.ctrl+alt+1), but Electron requires properly capitalized modifiers (e.g.Ctrl+Alt+1) to register shortcuts correctly.capitalizeAccelerator()utility tosrc/common/keybinding/index.jsthat normalizes modifier casing against a canonical map (Ctrl, Alt, Shift, Cmd, Meta, Super, AltGr, Option, CommandOrControl, CmdOrCtrl, Command, Control).key-input-dialog.vueimmediately after capturing the accelerator, before saving._isDefaultBindinginKeybindingConfigurator.jsto useisEqualAccelerator(case-insensitive) instead of strict equality, so re-entering a default binding is correctly recognized.Test plan
capitalizeAccelerator()covering all modifier names, mixed case, empty/null input, and multi-modifier combinations (test/unit/specs/capitalize-accelerator.spec.js)Ctrl+Alt+1(notctrl+alt+1)🤖 Generated with Claude Code