-
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
Windows Terminal 1.1 breaks remapped CapsLock key inside WSL #7120
Comments
So, I actually can reproduce this in WSL outside of the Terminal. Here's the result of pressing my remapped caps lock under This is an unfortunate casualty of the better (I know, it's ironic) keyboard support offered by #6309. There's two issues here:
This worked before #6309 because the remote app (here, WSL) was never made aware that somebody pressed Ctrl without a scancode. WSL can't remove the check in (2) because it would break one of the few valid ways to insert debugging informationreal ctrl (left) key
remapped
second field is |
Thanks, @DHowett, for finding the root cause and describing in an easy to understand way! |
How do you find these? |
So, somebody else reported a similar bug and @lhecker investigated it pretty quickly. We think we can fix this on our side 😄 without requiring any powertoys changes. |
Up until #4999 we deferred all key events to the character event handler for which `ToUnicodeEx` returned a valid character and alternatively those who aren't a special key combination as listed in `TerminalInput`'s implementation. Since #4999 we started acknowledging/handling all key events no matter whether they're actually a known key combination. Given non-ASCII inputs the Win32 `SendInput()` method generates certain sequences that aren't recognizable combinations though and if they're handled by the key event handler no follow up character event is sent containing the unicode character. This PR adds another condition and defers all key events without scan code (i.e. those not representable by the current keyboard layout) to the character event handler. I'm absolutely not certain that this PR doesn't have a negative effect on other kinds of inputs. Is it common for key events to not contain a scan code? I personally haven't seen it happen before AutoHotKey/SendInput. Before this PR is merged it'd be nice to have a good testing plan in place in order to ensure nothing breaks. ## Validation Steps Performed Remapped `AltGr+8` to `»` using AutoHotKey using `<^>!8::SendInput {Raw}»`. Ensured `»` is printed if `AltGr+8` is pressed. Closes #7064 Closes #7120
Up until #4999 we deferred all key events to the character event handler for which `ToUnicodeEx` returned a valid character and alternatively those who aren't a special key combination as listed in `TerminalInput`'s implementation. Since #4999 we started acknowledging/handling all key events no matter whether they're actually a known key combination. Given non-ASCII inputs the Win32 `SendInput()` method generates certain sequences that aren't recognizable combinations though and if they're handled by the key event handler no follow up character event is sent containing the unicode character. This PR adds another condition and defers all key events without scan code (i.e. those not representable by the current keyboard layout) to the character event handler. I'm absolutely not certain that this PR doesn't have a negative effect on other kinds of inputs. Is it common for key events to not contain a scan code? I personally haven't seen it happen before AutoHotKey/SendInput. Before this PR is merged it'd be nice to have a good testing plan in place in order to ensure nothing breaks. ## Validation Steps Performed Remapped `AltGr+8` to `»` using AutoHotKey using `<^>!8::SendInput {Raw}»`. Ensured `»` is printed if `AltGr+8` is pressed. Closes #7064 Closes #7120 (cherry picked from commit b617c43)
🎉This issue was addressed in #7145, which has now been successfully released as Handy links: |
Environment
Steps to reproduce
Expected behavior
"Caps Lock" should be treated as "Ctrl". No visible result.
Actual behavior
"Caps Lock" is treated as "Control-Space", and tries insert any previously inserted text again.
Work-Around
The issue goes away by adding this to settings.json
Therefore it is likely caused by #6309
More Details, Debugging info
I originally thought it was a bug in PowerToys, but since the work-around works, I figure the bug must be here.
It's a bit annoying, because I like to escape out of normal mode in vim by pressing
<CapsLock>-[
(which should be treated as<Ctrl>-[
, which is again treated as<esc>
). Now I instead insert the text i wrote twice.If i input
<Ctrl-V><Caps-Lock>
in Vim insert mode, vim inserts<C-Space>
. This is how I determined the remapped key is interpreted as<C-Space>
.The text was updated successfully, but these errors were encountered: