Repository navigation
Fixed #5205: Ctrl+Alt+2 doesn't send ^[^@ - #5272
1 commit merged into
Conversation
|
BTW I couldn't run tests locally, because I'm faced with the following error: |
Mike Griese (zadjii-msft)
left a comment
There was a problem hiding this comment.
I'm pretty much okay with this, but let's see those test pass :)
| WORD TerminalInput::_ScanCodeFromVirtualKey(const WORD vkey) noexcept | ||
| { | ||
| return LOWORD(MapVirtualKeyW(vkey, MAPVK_VK_TO_VSC)); | ||
| } |
There was a problem hiding this comment.
Part of me thinks we should move these helpers to some shared space, since this isn't the first time this has been written, but that's probably a better follow-up codehealth task.
| if (ch == 0) | ||
| { | ||
| // There are a few vkeys that MapVirtualKeyW() above turns into 0, | ||
| // while TerminalInput is still capable of processing them. | ||
| // The important ones are tested in DifferentModifiersTest/TerminalInputNullKeyTests. | ||
| continue; | ||
| } |
There was a problem hiding this comment.
Mike Griese (@zadjii-msft) In order for the tests to work again I disabled tests for certain Ctrl+Alt combinations as you can see here.
We could make the tests work if we pull in the ToUnicodeEx() logic into this file as well. If we do that though we should probably really create a helper file that contains this function separately. 😄
On the other hand I personally kinda doubt that this if condition makes this unit test any worse, because to fix this unit test we have to basically add a identical copy of the TerminalInput::_CharacterFromAltCtrlKeyEvent method.
And IMHO that way we'd just test for the current state of affairs of which OS methods we use instead for the actual results that we'd like to see for each character, you know? 🤔
There was a problem hiding this comment.
Yea this is fine with me
|
Mike Griese (@zadjii-msft) Now the build bot is facing the same issue I had earlier: What do? 😱 |
|
maybe re-queueing it will help. maybe there was a VS update. :/ |
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Mike Griese (zadjii-msft)
left a comment
There was a problem hiding this comment.
Thanks for fixing this too!
| if (keyEvent.IsModifierPressed() && _searchWithModifier(keyEvent, senderFunc)) | ||
| { | ||
| return true; | ||
| } |
There was a problem hiding this comment.
Yea moving this seems fine to me, it's not like the code that was before it was having any effect on this block, so it can life here just fine.
| if (ch == 0) | ||
| { | ||
| // There are a few vkeys that MapVirtualKeyW() above turns into 0, | ||
| // while TerminalInput is still capable of processing them. | ||
| // The important ones are tested in DifferentModifiersTest/TerminalInputNullKeyTests. | ||
| continue; | ||
| } |
There was a problem hiding this comment.
Yea this is fine with me
|
Mike Griese (@zadjii-msft) I believe I made a mistake in this PR. I tested it again just now and Also there's the fact that |
|
Mike Griese (@zadjii-msft) I guess I can't figure out anymore how I originally fixed the issue. 😐 One quick question regarding this PR though: Should I revert my addition of
The current solution with But the downside to the What are your thoughts about this? |
|
I kinda forgot about this PR. 😅 I‘ll try to tackle this again soon. |
Misspellings found, please review:
To accept these changes, run the following commands from this repository on this branch✏️ Contributor please read thisBy default the command suggestion will generate a file named based on your commit. That's generally ok as long as you add the file to your commit. Someone can reorganize it later.
If the listed items are:
See the 🔬 You can test your commits without appending to a PR by creating a new branch with that extra change and pushing it to your fork. The check-spelling action will run in response to your push -- it doesn't require an open pull request. By using such a branch, you can limit the number of typos your peers see you make. 😉 🗜️ If you see a bunch of garbage and it relates to a binary-ish string, please add a file path to the File paths are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your files.
|
1 similar comment
Misspellings found, please review:
To accept these changes, run the following commands from this repository on this branch✏️ Contributor please read thisBy default the command suggestion will generate a file named based on your commit. That's generally ok as long as you add the file to your commit. Someone can reorganize it later.
If the listed items are:
See the 🔬 You can test your commits without appending to a PR by creating a new branch with that extra change and pushing it to your fork. The check-spelling action will run in response to your push -- it doesn't require an open pull request. By using such a branch, you can limit the number of typos your peers see you make. 😉 🗜️ If you see a bunch of garbage and it relates to a binary-ish string, please add a file path to the File paths are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your files.
|
Mike Griese (zadjii-msft)
left a comment
There was a problem hiding this comment.
why did we never merge this before...?
|
Hello Mike Griese (@zadjii-msft)! 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: |

Summary of the Pull Request
Fixes #5205, by replacing another use of
MapVirtualKeyWwithToUnicodeEx.The latter just seems to be much more consistent at translating key combinations in general.
In this particular case though it fixes the issue, because there's no differentiation in
MapVirtualKeyWfor whether it failed to return a character ('\0') or succeeded in turning^@into'\0'.ToUnicodeExon the other hand returns the success state separately from the translated character.PR Checklist
Detailed Description of the Pull Request / Additional comments
This PR changes the behavior of the
⚠️ ⚠️
Ctrl+Alt+Keyhandling slightly:ToUnicodeExreturns unshifted characters.For instance
Ctrl+Alt+ais now turned into^[^a. Due to how ASCII works this is essentially the same though because'A' & 0b11111and'a' & 0b11111are the same.Validation Steps Performed
showkey -aCtrl+Alt+Spaceas well asCtrl+Alt+Shift+2are turned into^[^@Ctrl+Alt+Keycombination behave identical to the current master