Make sure VT reports still work when DECARM is disabled#14216
Merged
2 commits merged intomicrosoft:mainfrom Oct 14, 2022
Merged
Make sure VT reports still work when DECARM is disabled#142162 commits merged intomicrosoft:mainfrom
2 commits merged intomicrosoft:mainfrom
Conversation
DHowett
approved these changes
Oct 13, 2022
src/terminal/input/terminalInput.cpp
Outdated
| } | ||
|
|
||
| // Check if this key matches the last recorded key code. | ||
| const auto matchingLastKeyPress = _lastVirtualKeyCode && _lastVirtualKeyCode.value() == keyEvent.GetVirtualKeyCode(); |
Member
There was a problem hiding this comment.
cute std::optional trick: you don't need to check whether the optional is populated before doing a comparison; nullopt == T{} will always return false
Collaborator
Author
There was a problem hiding this comment.
Oh wow, that's neat! Thank you!
lhecker
approved these changes
Oct 14, 2022
|
Hello @DHowett! Because this pull request has the p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (
|
|
🎉 Handy links: |
This pull request was closed.
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.
The way
DECARMwas initially implemented, we checked for repeated keypresses by matching the last recorded virtual key code, and used a 0 key
code to indicate that no key was pressed. This caused the VT query
responses to fail, because they generated key events with a 0 key code,
and that would end up being detected as a repeated key that should be
suppressed.
This PR fixes that issue by using a
std::optionalto track the lastkey code, so if no key has been pressed we can represent that with
std::nullopt, and there's no way that can be confused with a genuinekey press.
The
DECARMmode was introduced in PR #13981.Validation Steps Performed
I've manually tested in Vttest to confirm that the query reports are now
working again, even when
DECARMis disabled. I've also checked thatDECARMitself it still working as expected.Closes #14208