PowerToys: [KBM]: Remap of PgUp/Home, PgDown/End doesn't work with SHIFT
Environment
Windows build number: Microsoft Windows [Version 10.0.18363.836]
PowerToys version: 0.18.0
PowerToy module for which you are reporting the bug (if applicable): Keyboard Manager
Unfortunately, I have a less than desirable keyboard layout on my laptop that I’ve struggled with for 8 or so years. I tried the standard Windows Keyboard mapper utility years ago, but it did not do what I wanted. Fast forward to yesterday, and I installed the PowerToys and discovered I can map the keys I want. And it seemingly worked! Yay. Except…then it didn’t.
My keyboard requires me to use <kbd>Fn+PgUp</kbd> for <kbd>Home</kbd> and <kbd>Fn+PgDn</kbd> for <kbd>End</kbd>. Being a programmer, that is extremely non-ideal.
Steps to reproduce
So, I implemented the following mappings:
- <kbd>PgUp</kbd> -> <kbd>Home</kbd>
- <kbd>Home</kbd> -> <kbd>PgUp</kbd>
- <kbd>PgDn</kbd> -> <kbd>End</kbd>
- <kbd>End</kbd> -> <kbd>PgDn</kbd>
As I indicated, these keys are remapped as desired. However, all was not working as I had hoped.
Actual behavior
However, while coding in Visual Studio, I went to highlight a line of code using <kbd>Shift+Home</kbd>. But the line was not highlighted. The cursor simply moved to the beginning of the line. The same was true for <kbd>Shift+End</kbd>, the cursor was simply moved to the end of the line. (I just tried in the web browser in this here issue editor, and the same thing happens when using those key combinations.)
Additionally, the same behavior is true of <kbd>Shift+PgUp</kbd> and <kbd>Shift+PgDn</kbd>: the cursor moves to the beginning/end of a page of text but does not cause a selection to occur.
And again I remind you, that in order to access the physical <kbd>Home</kbd> and <kbd>End</kbd> keys on my laptop keyboard requires the use of the <kbd>Fn</kbd> key—perhaps that has something to do with “losing” the <kbd>Shift</kbd> modifier.
Surprisingly, <kbd>Ctrl+Home</kbd> and <kbd>Ctrl+End</kbd> result in the correct behavior. And, <kbd>Ctrl+PgUp</kbd> and <kbd>Ctrl+PgDn</kbd> work, too. (And again, two of these key combos also require the use of the <kbd>Fn</kbd> key—so it’s odd that there doesn’t seem to be a problem with <kbd>Ctrl</kbd> but there is with <kbd>Shift</kbd>.)
Expected behavior
I expect that using the <kbd>Shift</kbd> modifier with any remapped keys would work as with any other keyboard key modifier.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 2
- Comments: 16 (7 by maintainers)
Fixed in 0.19.0, please visit https://github.com/microsoft/PowerToys/releases/ for the latest release
@fourpastmidnight we’ve got a fix for it and this should be working in our next release! 😃 Turns out there was a bug in the way we were handling Home, End, Del, Ins, Pg keys and the arrow keys. We were sending the NumPad equivalents of those keys rather than the normal variants (we were missing a flag that was to be set), which is probably why the behavior was weird when NumLock was on, since those keys aren’t supposed to exist. This was also causing two other bugs as well with completely random and not obvious side effects like this one.
I finally got a reliable repro on this. Not entirely sure why this happens, but it looks like NumLock seems to be messing things up. When NumLock is off, Shift+Home/PgUp should work as expected, but when is turned on then Shift+Home sends only Home then followed by Shift and I can reproduce the behavior @lrushl mentioned. Thanks for finding this @fourpastmidnight and thanks for the insight @lrushl. Now that we have a clear idea of “what’s happening” it should be much easier to fix.
What I’ve also discovered and hoped that it could be useful in order to further troubleshoot this issue is the following (for more details please take a look into gif recording below):
That is why I assume that this can explain why the “Ctrl + Home” work and the “Shift + Home” don’t for the same mapping.
@arjunbalgovind I tested turning off <kbd>NumLk</kbd> and then using <kbd>Shift+Home</kbd> and it worked as expected! Wow, that’s really strange.