-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow the mapping of OEM keys ({}|\<>/_-=+) in key bindings #2067
Conversation
This commit introduces support for key bindings containing keys traditionally classified as "OEM" keys. It uses VkKeyScanW and MapVirtualKeyW, and translates the modifiers that come out of VkKeyScanW to key chord modifiers. The net result of this is that you can use bindings like "ctrl+|" in your settings. That one in particular will be reserialized (and displayed in any menus) as "ctrl+shift+\". Admittedly, this is not clear, but it _is_ the truest representation of the key. This commit also moves the Xaml key chord name override generator into App as a static function, *AND* it forces its use for all modifier names. This will present a localization issue, which will be helped in part by #1972. This is required to work around microsoft/microsoft-ui-xaml#708. I've kept the original code around guarded by a puzzling ifdef, because it absolutely has value. Fixes #1212.
I reckon @shanselman will like this. Also, it makes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
God bless you for fixing this one. I think I'm a little confused by the whole DEP_MICROSOFT_UI_XAML_708_FIXED
thing - maybe coffee hasn't kicked in quite yet. I'm otherwise fine with this.
// Method Description: | ||
// - Takes a MenuFlyoutItem and a corresponding KeyChord value and creates the accelerator for UI display. | ||
// Takes into account a special case for an error condition for a comma | ||
// Arguments: | ||
// - MenuFlyoutItem that will be displayed, and a KeyChord to map an accelerator | ||
void App::_SetAcceleratorForMenuItem(Windows::UI::Xaml::Controls::MenuFlyoutItem& menuItem, const winrt::Microsoft::Terminal::Settings::KeyChord& keyChord) | ||
{ | ||
#ifdef DEP_MICROSOFT_UI_XAML_708_FIXED |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this right?
Until 708 is fixed, always use the KeyboardAcceleratorTextOverride
method.
When 708 is fixed, if it's not a comma, set the Keyboard accelerator. If it is a comma, still use the override thing.
Would we still need the else when 708 is fixed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'd probably yank the comma check as well, and the other accelerator formatting code. I wanted this diff to be "approximately" minimal, however
Magical.
…On Tue, Jul 23, 2019 at 6:15 AM Mike Griese ***@***.***> wrote:
***@***.**** approved this pull request.
God bless you for fixing this one. I think I'm a little confused by the
whole DEP_MICROSOFT_UI_XAML_708_FIXED thing - maybe coffee hasn't kicked
in quite yet. I'm otherwise fine with this.
------------------------------
In src/cascadia/TerminalApp/App.cpp
<#2067 (comment)>:
> // Method Description:
// - Takes a MenuFlyoutItem and a corresponding KeyChord value and creates the accelerator for UI display.
// Takes into account a special case for an error condition for a comma
// Arguments:
// - MenuFlyoutItem that will be displayed, and a KeyChord to map an accelerator
void App::_SetAcceleratorForMenuItem(Windows::UI::Xaml::Controls::MenuFlyoutItem& menuItem, const winrt::Microsoft::Terminal::Settings::KeyChord& keyChord)
{
+#ifdef DEP_MICROSOFT_UI_XAML_708_FIXED
Is this right?
Until 708 is fixed, always use the KeyboardAcceleratorTextOverride method.
When 708 is fixed, if it's not a comma, set the Keyboard accelerator. If
it is a comma, still use the override thing.
Would we still need the else when 708 is fixed?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#2067?email_source=notifications&email_token=AAAAWTHCHWSNHIOQAC3ZT2DQA375RA5CNFSM4IF76VM2YY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOB7IZ7KI#pullrequestreview-265396137>,
or mute the thread
<https:/notifications/unsubscribe-auth/AAAAWTAGDD2VXIWKEKBYI6LQA375RANCNFSM4IF76VMQ>
.
|
🎉 Handy links: |
This commit introduces support for key bindings containing keys
traditionally classified as "OEM" keys. It uses VkKeyScanW and
MapVirtualKeyW, and translates the modifiers that come out of
VkKeyScanW to key chord modifiers.
The net result of this is that you can use bindings like "ctrl+|" in
your settings. That one in particular will be reserialized (and
displayed in any menus) as "ctrl+shift+". Admittedly, this is not
clear, but it is the truest representation of the key.
This commit also moves the Xaml key chord name override generator into
App as a static function, AND it forces its use for all modifier
names. This will present a localization issue, which will be helped in
part by #1972. This is required to work around
microsoft/microsoft-ui-xaml#708. I've kept the original code around
guarded by a puzzling ifdef, because it absolutely has value.
Fixes #1212.
Renormalization
"alt+="
"alt+plus"
"alt+:"
"alt+shift+;"
"ctrl+?"
"ctrl+shift+/"
"shift+~"
"shift+<backtick>"
(markdown limitation)
"alt+}"
"alt+shift+]"
"ctrl+alt+<pipe>"
"ctrl+alt+shift+\\"
"shift+\""
"shift+'"
"alt+,"
"alt+,"
"ctrl+-"
"ctrl+-"
"shift+."
"shift+."
PR Checklist
Validation Steps Performed
Manual