-
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
AltGR SEQUENCES DO NOT WORK -- Can't type any AltGr combinations in Windows Terminal #521
Comments
Update: Same thing happens with all digits when combined with |
You know, this is probably on me. We're probably not getting vkey correctly for AltGR combos somewhere in TermControl.cpp, when we get the KeyDown event. |
Kinda unrelated, but what software did you use to get a recording with the keys you pressed in the gif @patriksvensson ? |
@watermelonpizza I used Carnac to display the key presses and ScreenToGif to capture the window. |
Oh carnac, awesome thanks! I'll add that to my list of goodies :) |
I think this is a duplicate of #487. |
Whoops, it looks like the left hand doesn't know what the right hand is doing, and I just created a circular duplicate link. |
Can confirm this issue on Windows version 10.0.18362.30 with Hungarian keyboard layout. The behavior is different, depending on what console I'm using:
|
@zadjii-msft I found your (?) AltGr related comment in Thus I replaced... if (keyEvent.IsAltPressed() && keyEvent.IsCtrlPressed())
{
return false;
} ...and it works! For now. 😅 It will delegate the handling to WM_CHAR/_CharacterHandler which according to Google is more robust for AltGr handling. (?) (I'm not very familar with Windows programming yet.) |
@lhecker Awesome! Now this is actually usable 🎉 |
@lhecker Yes, please submit a PR. On german keyboards I can't input the pipe right now which makes the terminal kinda hard to use. |
I feel like my change is incorrect though. There must be a reason why not all characters are handled by |
The actual cause is in Terminal.cpp DWORD modifiers = 0
| (ctrlPressed? LEFT_CTRL_PRESSED : 0)
| (altPressed? LEFT_ALT_PRESSED : 0)
| (shiftPressed? SHIFT_PRESSED : 0); You can see that the RIGHT_ALT_PRESSED is never correctly detected here, which causes keyEvent.IsAltGrPressed in TerminalInput::HandleKey return false. Btw, the modifiers state is acquired by _GetPressedModifierKeys() in TermControl::_KeyDownHandler(). instead of a boolean value, you can pass the modifiers state directly into SendKeyEvent, and determine whether the left/right ctrl, left/right alt, left/right shift is pressed later. And there are already defined as follows in VirtualKey, which can be used in TermControl::_GetPressedModifierKeys() LeftShift = 160,
RightShift = 161,
LeftControl = 162,
RightControl = 163,
LeftMenu = 164,
RightMenu = 165, |
Ah nice catch @sagood! |
@lhecker I have tried to use RIGHT_ALT_PRESSED instead to initialize DWORD modifiers. I tested AltGr + '+' (= ~), it will be correctly shown in the console. But AltGr+Q does not seem work indeed. weird. By setting up a new c# UWP, I observed that the key sequence while using AltGr is as follows,
(take AltGr + Q as an example) |
Further debugging shows that if you force the program to run the first condition branch of TerminalInput::HandleKey from terminalInput.cpp as shown below, if (!fKeyHandled)
{
if ((keyEvent.GetVirtualKeyCode() < '0' || keyEvent.GetVirtualKeyCode() > 'Z') &&
keyEvent.GetVirtualKeyCode() != VK_CANCEL)
{
// !!!force the AltGr+'Q/E' case to run here, not the one below
fKeyHandled = _TranslateDefaultMapping(keyEvent, GetKeyMapping(keyEvent), GetKeyMappingLength(keyEvent));
}
else
{
...
}
} AltGr+Q will work. |
How about AltGr+ß for \ on the German keyboard, that one has the same problem |
All AltGr keyboard combinations are affected by the same issue. |
I confirm the new shortcuts do break AltGr ( The reason some of us didn't see the regression is related to the 0.3 upgrade not overriding an existing
One can use ctrl+alt+shift+digit, althought that's not very easy to key in... |
@henrik-jensen I opened #2235. @thorsig You've already been told what the state of affairs in the Windows API landscape is. |
It is easier to use alt+digit and it is similar to the shortcuts in gnome-terminal. |
If you use Alt+digit, be aware that you won’t be able to send those keys into a console application. |
🎉This issue was addressed in #2235, which has now been successfully released as Handy links: |
AltGr ( Good job! |
Thanks for the confirmation! |
You're very welcome! |
0.3.2171.0 fix confirmed for my system - Danish keyboard Win10 Home 1903 build 10.0.18362.267. |
Hi I think I have this problem on version 0.7. I can not enter the slash key on my keyboard either using the numeric keypad ou AltGr+Q (Brazilian ABTN2 keyboard of an Samsung laptop that doe not have the question mark/slash key). Edit: I can not enter any AltGr key. |
After remove an older version of PSReadline eveything is working now. |
FWIW, I have written the attached PowerShell scripts to verify what versions of PSReadline are on my system / which one is active. HTH |
To fix the same issue as beppler reported, do:
From elevated powershell Session do:
From elevated cmd session do: |
What's the status of this issue? This is happening to me with the latest version of the windows terminal, at the moment of writing is:
|
@ilmax I broke Alt+Numpad input in #3117. Now that #3117 had been merged and the associated issue been fixed, we could work on reintroducing numpad input into the code base. |
@lhecker thanks for the quick response, I just wanted to know the state of this because every issue I found was closed but the problem is still there. I just wanted to know how to fix my workflow for git rebase -i because now I have to open something like notepad++, type the ~ character, copy it and paste it in the terminal. |
Just so I understand: you’re on a thread about AltGr with a question about alt+numpad sequences? This may be why all the threads you’re finding are closed: the AltGr problem is fixed. I do believe we have a separate issue tracking alt+numpad input problems. |
Yep, you're right, sorry for the confusion. I think #657 may the the correct one |
Your Windows build number:
10.0.18362.86
What you're doing and what's happening:
Trying to enter the
@
sign on a Swedish keyboard in a PowerShell console usingAlt Gr
+2
.See animated gif:
What's wrong / what should be happening instead:
Windows terminal shows
digit-argument
instead of outputting the@
sign as expected.It's possible this is a PEBKAC error somehow but the problem doesn't show up in the normal PowerShell console... 😓
The text was updated successfully, but these errors were encountered: