-
Notifications
You must be signed in to change notification settings - Fork 8.4k
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
Ctrl+Alt+'char' generates other chars then 'AltGr' (Germany Layout) v0.11.1121.0 #5525
Comments
Congratulations, since you posted the thread first, you get to be the tracking thread for this issue. @lhecker (our resident person who owns a non-en-us keyboard) for visibility. From other threads:
|
Sorry for that. This issue is caused by me removing this particular character range check in #4192: terminal/src/terminal/input/terminalInput.cpp Lines 482 to 483 in 5de9fa9
@zadjii-msft I'd gladly submit a PR which re-adds the vkey range check. In all these years I honestly personally never used CtrlAlt as a replacement for AltGr, which is why I didn't check this at all. 😞
|
@lhecker that would be much appreciated, thanks :) I'll throw you on the assigned to line. I wouldn't worry about it too much, in all my years I honestly have never used an AltGr key so it's hard for me to check any of this 😆 |
This PR fixes #5525 by re-adding range checks that were erroneously removed in a9c9714. ## Validation Steps Performed * Enabled a German keyboard layout * Entered `<`, `+`, `7`, `8`, `9`, `0` while holding either Alt+Ctrl or AltGr and... * Ensuring that both produce `|`, `~`, `{`, `[`, `]`, `}` Closes #5525
🎉This issue was addressed in #5552, which has now been successfully released as Handy links: |
I think the idea that Ctrl+Alt should always be the same as AltGr is wrong. The purpose of these key combinations is not the same. AltGr effectively extends the basic keyboard layout, while plain Alt is a generic modifier. |
Hm. Probably this is a correct technical explanation. But by experience, every program or tool (Word, Excel, cmd, Notepad, VSCode, pwsh, ...) I use with a german keyboard layout generates an Probably it is an windows thing. Wikipedia states this about this topic:
Source Wikipedia After I found this, I also tested it in WSL2 (Ubuntu 18.04.3 LTS) and here the |
@mintty As you probably already know, Windows treats Ctrl+Alt as a substitute for AltGr. If you use an English keyboard layout you should notice that the Terminal app correctly produces a9c9714 is the commit which broke this common Windows behavior and users rightfully complained. #5552 then reverted/fixed parts of a9c9714 which restored it. |
@Ztarbox Yep it's 100% a Windows thing. If you use Linux/Ubuntu (without WSL), I config setting would be nice to have in the future, but it might be kinda hard to get the setting value inside the |
No, you cannot generally take experience from one program to another. Tools like Word have their own concepts, e.g. you can define Ctrl+Alt shortcuts in them, and they may have a simplified view on keyboard capabilites. For a terminal, on the other hand, Ctrl, Alt, and some others are modifiers that should be available in turn for terminal applications (e.g. emacs) in full flexibility, mediated through escape sequences generated by the terminal, which can only work reliably if those modified key presses are not overloaded by simplified interpretation.
Do you have a reference for this claim? I doubt it. It's not a Windows thing, it's a Windows applications thing. And the instance that many applications do that (and actually do it wrong) does not make it better. |
I believe I can. If I could use this functionality for decades in almost every (windows based) program I was using, I assume the same functionality for other programs (also terminals - or are these shells? I always mix them up in my mind - like powershell or cmd where this functionality is working). When Apple invented the swipe to navigate - now everyone expects to navigate this way on mobile phones in every app.
Me and @lhecker both included links to wikipedia that both stated this Windows behavior, but I accept not everyone accepts wiki as a reference. So probably this is a prove? These are screenshots of the Windows On-Screen Keyboard. It shows the same layout change for The On-Screen Keyboard shows always this behavior regardless if the program I use interprets |
We're not talking about swipes and other graphical or touch-sensitive interaction paradigms, we're talking about text-based terminals.
In fact not, they're not a proof. So I took the occasion to make some small changes there, amended with entries in the "Talk" pages asking that "if anyone feels it should be reverted, please add a reference to an authoritative specification of that behaviour in Windows". Let's take a look at MS Word: AltGr+E is € and by default Ctrl+Alt+E is €, too. But via Insert – Symbols you can define shortcuts and for example assign Æ to Ctrl+Alt+E. AltGr+E will then still generate €. |
"I doubt it."? Well I beg to differ! Both You're making it painfully clear that you will absolutely not listen to anyone else's experience, so maybe the above <100 LOC will prove to you somehow, that... |
Here are your authoritative sources for Wikipedia by the way:
I'm certain actual OS sources won't be posted. I'd like to stress once again that a config setting for this would be most preferable, but - as usual - someone will have to open a PR for that. |
Come on, this is nonsense. I was just asking for a specification rather than speculation by experience.
This is still not a strict conclusion. A terminal is not like any other GUI application. I've outlined the difference above and explained the use case. If a terminal had the option to choose behaviour, I wouldn't mind the default value, but constant remapping of Ctrl+Alt so that this modifier combination is not usable is not a good idea. |
You edited Wikipedia (!!) within... 3 hours after the start of this discussion, despite it containing a very credible source for that claim (oldnewthing), further sources for this being easily discoverable using Google AND two people telling you about this fact. And on top of that you write in Talk:AltGr that you changed this "following a discussion", which couldn't ever be further from the truth. Anyways, we now know that applications with keyboard input on Windows are officially supposed to treat Ctrl+Alt as a substitute for AltGr. We've thus established that the current behavior correctly matches the default behavior and thus isn't a bug. |
Let's not run a fruitless blame war here. The few words I changed on Wikipedia were not wrong, and the inclusion of references (which were missing for the original claim) is a Wikipedia policy. I've meanwhile tuned the words again. And yet, your interpretation of the references ("applications ... are officially supposed...") is biased: For example,
means it's the system default, not a requirement for applications to follow this behaviour. |
Forgot to mention that actually one of your references supports my interpretation, regardless of actual Windows behaviour, it explicitly points out Right Alt:
|
Ctrl+Alt combinations are used a lot in Emacs, so having only Ctrl + Right Alt be AltGr would be very beneficial for tty Emacs. It seems like there won't be consensus on a single default, so would there be interest if I looked into adding a configuration option for this? |
FYI If you want to tackle this... Now that I finished writing this I realize that The decision code is here: terminal/src/terminal/input/terminalInput.cpp Lines 495 to 518 in c78f264
Implementing this isn't quite trivial I believe, because |
@vuori, thanks for offering this.
If you hook into the WM_KEYDOWN event, confining AltGr to Ctrl+right-Alt is not too difficult. You can modify the keyboard state before further interpretation with either TranslateMessage/WM_CHAR or ToUnicode (which seem to be the 2 options I see). |
@lhecker, thanks for the initiative. As a representative of a competitor application, it would have looked weird if I had raised an issue for it:) |
Environment
Steps to reproduce
In german keyboard layout type
Ctrl+Alt+<
(or any other key that has a 3rd char on it).Expected behavior
Shows the same as
AltGr+<
the pipe char:
|
Actual behavior
Shows the
#
hash sign.Additional remarks
This started on v0.11 till the fixing of AltGr months ago, this didn't happen till today.
On german keyboard layout at least, AltGr+key and Ctrl+Alt+key always return the same char.
some other examples on pwsh:
cmd in terminal returns also different chars but other (mostly
^]
or^\
)wsl doesn't support Ctrl+Alt at all, but I don't need it there and I'm not sure, if it worked there till v0.11,
I mostly recognized this problem while typing PowerShell, cause its way faster to create the
|
(pipe) usingCtrl+Alt+<
on the left side of the keyboard thenAltGr+<
cause this would require two hands.The text was updated successfully, but these errors were encountered: