-
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
During Alt+Numpad composition, stash keys in case we bail out #17774
Conversation
We were erroneously eating Alt followed by VK_ADD. This change makes sure we cache key presses and releases that happen once a numpad composition is active so that we can send them when you release Alt. Right now, we only send them when you release Alt after composing Alt and VK_ADD (entering hex mode) and only if you haven't inserted an actual hex numpad code. This does mean that `Alt VK_ADD 0 0 H I` will result in an input of "+hi". That... seems like a small price to pay for Alt VK_ADD working again. Closes #17762
s.encoding = AltNumpadEncoding::Unicode; | ||
s.accumulator = 0; | ||
s.active = true; | ||
if (keyDown) |
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.
I had to move keyDown into these places so we could stash the keyUp event in case composition was active.
This makes ALTdown KP+down KP+up ALTup
work.
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.
This may be easier to read if the if (keyDown)
was outside the if/else chain instead of inside it.
} | ||
// Send the alt keyup we are currently processing | ||
h = h && _TrySendKeyEvent(vkey, scanCode, modifiers, keyDown); | ||
// do not accumulate into the buffer |
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.
oh we should probably return h somewhere...
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.
I don't have time to read this, but I think this is fine with one sign-off
@@ -262,6 +262,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation | |||
// The state can be active, while the accumulator is 0, if the user pressed Alt+Numpad0 which enabled | |||
// the OEM encoding mode (= active), and then pressed Numpad0 again (= accumulator is still 0). | |||
bool active = false; | |||
til::small_vector<std::tuple<WORD, WORD, ::Microsoft::Terminal::Core::ControlKeyStates, bool>, 4> cachedKeyEvents; |
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.
I'd introduce a struct for this to make it more descriptive.
s.encoding = AltNumpadEncoding::Unicode; | ||
s.accumulator = 0; | ||
s.active = true; | ||
if (keyDown) |
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.
This may be easier to read if the if (keyDown)
was outside the if/else chain instead of inside it.
We were erroneously eating Alt followed by VK_ADD. This change makes sure we cache key presses and releases that happen once a numpad composition is active so that we can send them when you release Alt. Right now, we only send them when you release Alt after composing Alt and VK_ADD (entering hex mode) and only if you haven't inserted an actual hex numpad code. This does mean that `Alt VK_ADD 0 0 H I` will result in an input of "+hi". That... seems like a small price to pay for Alt VK_ADD working again. Closes #17762 (cherry picked from commit e006f75) Service-Card-Id: PVTI_lADOAF3p4s4AmhmszgSF50M Service-Version: 1.21
This just adds a quick registry check for `EnableHexNumpad`. Depends on #17774 Closes #17762 (again) ## Validation Steps Performed * Alt + NumpadAdd + 221E doesn't do anything ✅ * Set the `EnableHexNumpad` registry key * Restart * Alt + NumpadAdd + 221E inserts ∞ ✅ (cherry picked from commit b520da2) Service-Card-Id: PVTI_lADOAF3p4s4AmhmszgTQsd8 Service-Version: 1.21
This just adds a quick registry check for `EnableHexNumpad`. Depends on #17774 Closes #17762 (again) ## Validation Steps Performed * Alt + NumpadAdd + 221E doesn't do anything ✅ * Set the `EnableHexNumpad` registry key * Restart * Alt + NumpadAdd + 221E inserts ∞ ✅ (cherry picked from commit b520da2) Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgTQseA Service-Version: 1.22
We were erroneously eating Alt followed by VK_ADD. This change makes sure we cache key presses and releases that happen once a numpad composition is active so that we can send them when you release Alt.
Right now, we only send them when you release Alt after composing Alt and VK_ADD (entering hex mode) and only if you haven't inserted an actual hex numpad code. This does mean that
Alt VK_ADD 0 0 H I
will result in an input of "+hi". That... seems like a small price to pay for Alt VK_ADD working again.Closes #17762