[WIP] [Keyboard Manager] Add exact match and orphaned-key notice to the new editor#49100
Draft
moooyo wants to merge 3 commits into
Draft
[WIP] [Keyboard Manager] Add exact match and orphaned-key notice to the new editor#49100moooyo wants to merge 3 commits into
moooyo wants to merge 3 commits into
Conversation
Close two functional-regression gaps in the new Keyboard Manager editor (KeyboardManagerEditorUI) relative to the classic C++ editor: - Exact Match: thread the origin-shortcut exactMatch flag through the native wrapper (AddShortcutRemap + ShortcutMapping struct), interop, and UI. Wired for all action types (key/shortcut, text, URL, program, disable) on multi-key shortcuts, with save/load/edit round-trip. The engine (MappingConfiguration) already serialized exactMatch. - Orphaned-key warning: wire up the previously-unused ValidationHelper.IsKeyOrphaned to warn (via a key-scoped, two-step InfoBar confirmation) when a single-key remap leaves the original key unassigned, mirroring the classic Remap Keys editor. The check runs before deleting the existing mapping so cancelling is non-destructive. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- EnableShortcut: re-enabling a multi-key text mapping went through the string AddShortcutMapping overload without exactMatch, silently clearing exact-match in the engine while editorSettings.json kept it. Now forwards exactMatch. - UnifiedMappingControl: the exact-match (and app-specific) checkbox enable state was only refreshed on keyboard-hook capture, not on dropdown key edits / auto-grow. Refresh it from _triggerKeys CollectionChanged so changing the trigger via the dropdown keeps the state in sync. - ValidationHelper.IsKeyOrphaned: only count RemapShortcut (key-output) mappings as restoring a key; program/URL/text targets do not make a physical key reachable again. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The orphaned-key warning previously blocked saving and required a second Save click to confirm, which is unintuitive in the new per-mapping flow. Change it to save in a single click and show a dismissible informational banner on the main page afterwards (only for single-key remaps that leave the original key with no assignment), so the operation is no longer interrupted. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.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 of the Pull Request
Closes two functional-regression gaps in the new WinUI 3 Keyboard Manager editor (
KeyboardManagerEditorUI, the default editor whenuseNewEditoris on) relative to the classic C++ XAML-Islands editor:PR Checklist
Detailed Description of the Pull Request / Additional comments
1. Exact Match
Shortcut::exactMatchalready exists in the engine and is (de)serialized byMappingConfigurationfor every shortcut remap type, but the new editor never exposed or persisted it. This PR threads it end-to-end:KeyboardManagerEditorLibraryWrapper): newexactMatchon theShortcutMappingstruct and theAddShortcutRemapexport;GetShortcutRemap/GetShortcutRemapByTypepopulate it from the origin shortcut.KeyboardManagerInterop,ShortcutKeyMapping,KeyboardMappingService): marshal the flag both ways (intacross the P/Invoke boundary,boolin managed code).UnifiedMappingControl,MainPage): anExactMatchCheckBox(enabled only for multi-key shortcuts), wired through all action types (key/shortcut, text, URL, program, disable) on save, load and edit — matching the classic editor, which gates exact-match on the origin shortcut regardless of target type.2. Orphaned-key notice
Wires up the previously-unused
ValidationHelper.IsKeyOrphanedto inform the user when a single-key remap leaves the original key unreachable. Because the new editor saves one mapping at a time (unlike the classic batch editor), this is surfaced as a non-blocking, dismissible InfoBar shown after saving — saving still completes in a single click — rather than a modal confirmation.Commits
b7556c8Add exact match and orphaned-key warning to the new WinUI3 editor3197ae1Fix issues found in review (exactMatch dropped on multi-key text re-enable; checkbox enable-state not synced on dropdown edits;IsKeyOrphanednow only counts key-output remaps as restoring a key)ab99b6fMake the orphaned-key warning a non-blocking noticeValidation Steps Performed
KeyboardManagerEditorLibraryWrapper(native) andKeyboardManagerEditorUI(C#) both build clean at x64 Debug (exit code 0).exactMatchfor shortcut→key/shortcut/program/URI/text, so the flag round-trips to both the enginedefault.jsonand the editor'seditorSettings.json.3197ae1(see commits).