Operating system or device - Godot version: Windows & non-english keyboard layout - All versions
Issue description: When not using english keyboard, writing special chars like '>' and '<' (and many more) must be done with shortcut (right) Alt Gr + <. Thats normal and fine, but on windows, lots of folks (like me) are used to (left) ctrl + (left)alt + < which does not work and is very annoying (you know, you are used to _type_ code one way for 8+ years and then, this one editor does not support it).
Source: https://en.wikipedia.org/wiki/AltGr_key#Control_.2B_Alt_as_a_substitute
Steps to reproduce:
set non english keyboard (czech in my case)
Godot -> script editor
Alt gr + > = '>'
Ctrl + Alt + > = ''
Every native windows app (eh, native... even GIMP support this):
Ctrl + Alt + > = '>'
Same problem on Win 10, Italian keyboard: can't access Alt-Code characters via Numeric Pad inside Godot's editor.
Example: The Bitwise NOT tilde character ~ is not present in Italian keyboards, and requires using an alt-code (Alt126) to display it. Currently the only way to produce a tilde in Godot's editor seems to be via cut-&-paste.
This is a list of commonly used characters which are not present in non-US keyboards and require an alt-code sequence under Windows OS:
~ tilde` backtickThey are all crucial character in programming/development envinroment, yet uneasy to obtain on many keyboards (especially on laptops which don't have numeric pad and require additional keystrokes).
Since different keyboard layouts might suffer from different lacks of characters, it would be nice to have Godot editor support standard Windows alt-codes, or (even better) offer some keystroke-combinations customization to make some characters easily reachable. (for example, in SublimeText is rather easy to set up custom key-combination, like Alt' for `)
The only other current alternative I can think of is switching the keyboard layout to US-EN keyboard during work sessions, which isn't an ideal solution for other open tools which support alt-codes.
Is there an ETA on this? I don't know of any workaround. Is it complicated to support this?
Ok, before Bugsquad intervention about old issues (also, BUMP! 😄 ): this still does not work & still annoy us, not US-keyboard-layout lover. (Godot 3.0.2 stable official)
I remember looking at this but it's not that easy to fix (at least I couldn't find any good documentation).
I have this same problem with Spanish keyboard, no Ctrl + Alt support.
Edit: I still can write what I need with Alt Gr, but I'm used to the other way.
Godot 3.06 64 bits Windows 10
Another bump for this, it's annoying to have to use uncommon / unpractised key combos on a QWERTZ keyboard layout to input symbols frequently needed when coding (~ | { } [ ]).
This issue still affects both the Godot script editor and the various text editing nodes. (3.2) This unfortunately makes Godot much less useful for making internationally supported applications and games involving lots of text entry.
This issue still affects both the Godot script editor and the various text editing nodes. (3.2)
I'm surprised that after four years this issue hasn't been solved yet. Also, it's quite rare to find editors that _don't_ support Alt-codes (after all, they are part of the native OS).
This unfortunately makes Godot much less useful for making internationally supported applications and games involving lots of text entry.
Indeed, I agree on this. At least, for me this has been a major draw back that ultimately kept me away from Godot. It's not just because it makes coding a slow and painful process (which does matter), but also due to the fact that it makes Godot a rather US-centric app — i.e., assumes users are working on a US keyboard.
I can't wrap my head around this. It's something rare to find in editors, and makes you wonder.
I'm surprised that after four years this issue hasn't been solved yet.
I didn't even know Ctrl + Alt could be used as an alternative to AltGr until this issue was bumped yesterday :slightly_smiling_face:
That said, that combination doesn't seem to work on Linux (using the "French - alternate" keyboard layout). I guess it's a Windows-only thing?
Anyway, as @vnen commented a while ago, the issue at hand is non-trivial. We don't have a whole lot of contributors experienced with Windows APIs after all.
It's something rare to find in editors, and makes you wonder.
Godot doesn't use a standard UI toolkit such as GTK+ or Qt, which may be a reason for this feature being absent. Maybe it's also due to how it handles input (but I don't know exactly why).
@Calinou:
That said, that combination doesn't seem to work on Linux (using the "French - alternate" keyboard layout). I guess it's a Windows-only thing?
Yes, Alt-codes are Windows only, although often the term is used to indicate any shortcut to access special characters absent in a keyboard. There are some equivalent short cuts on *nix machines, but these might be distro specific; I remember that working on Ubuntu I had to struggle because whenever I needed to access a special char I'd go in «auto-mode» and use the Windows combinations, which of course did not work.
Godot doesn't use a standard UI toolkit such as GTK+ or Qt, which may be a reason for this feature being absent.
I also think that's the root of the problem. The advantage of using well established UI libraries is that they already take care of this low-level stuff. Alt-codes is usually an expected feature in editors and text input controls, so it's not something you'll see advertised with neon lights in the features list of such libraries (or any editing application), it's just something we all expect to be present, due to usage experience.
I didn't even know Ctrl + Alt could be used as an alternative to AltGr until this issue was bumped yesterday
Actually, under Windows OS there are multiple ways to access special chars, depending on the required char (ASCII, Unicode, emoji, etc.), and in some cases on the application being used.
Probably the most important issue right now is being able to access standard ASCII characters which are required for coding (~, `, etc.), rather than the whole Unicode characters set. Although probably the best cross-platform solution would be to leverage the native OS API that deals with these type of shortcuts (which should cover all characters) rather than writing a custom code that can intercept key-combinations in real time and convert them to the desired characters (I agree, this would be a non-trivial task).
Thanks for bump. Four years later and I'm still annoyed. (Godot hobbyist but full-time c# dev - so, lots and lots of code typed in Win :) )
I didn't even know Ctrl + Alt could be used as an alternative to AltGr until this issue was bumped yesterday 🙂
It can indeed. I _think_ Windows treats Ctrl + Alt and AltGr as functionally equivalent in most situations, with the possible exception of some specific keyboard layouts and system hotkeys. Although I'm not sure of specifics. (I know AltGr + Delete isn't possible though. 😋)
However, on some countries' keyboard layouts, constantly using AltGr instead of Ctrl + Alt can be pretty straining on the wrist and fingers. I've also met many people who don't even realize AltGr can be used for anything. Older people, schoolkids, and even some programmers and tech specialists.
A possible hack might be detecting when Ctrl + Alt is held and converting it to an AltGr input? Although with no knowledge of how Godot handles key input, I wouldn't be surprised if this is easier said than done, and might just introduce a bunch of other issues.
A possible hack might be detecting when Ctrl + Alt is held and converting it to an AltGr input? Although with no knowledge of how Godot handles key input, I wouldn't be surprised if this is easier said than done, and might just introduce a bunch of other issues.
I think the problem here is providing a cross-platform solution. The best thing would be to find a ready-made library that leverages each OS native functionality and provides a good customization interface. I don't know of any, but there must something in the wild.
It doesn't need to be cross-platform since it's a Windows feature. And it also shouldn't require any hacks as the OS should serve the input pre-processed if it's an OS feature, like Linux distros will do whenever you use AltGr or the Compose key to input special characters (which works out of the box on Godot and any Linux application).
So this needs looking into how Windows' Ctrl+Alt == AltGr feature works internally, and then try to figure out why it's not working with Godot's input processing. Could be that Windows does not pre-processor the input and lets all applications do the handling manually, but if so that's pretty bad design on their end. If that's the case however, I expect that it should be covered in MSDN, as they usually have fairly decent documentation for Windows APIs.
Good to know that at least on Linux Alt keys work as expected.
So this needs looking into how Windows' Ctrl+Alt == AltGr feature works internally,
The feature is available in any of Windows OS native text-input controls, coders don't have to do anything special to enable it. But I have no idea how the same functionality can be enabled in custom controls. Probably a good starting point would be to look at some cross platform third party GUI libraries that don't use Win native UI controls, check if they support Alt codes, and if they do find out how they managed that.
I've been peeking at MSDN documentation on keyboard input; the whole issue seems complicated by the fact that Alt codes work partly due to the keyboard (hardware + driver) itself, and partly due to how the WinAPI interprets these "virtual key" sequences.
What I did find, though, is a very interesting document by keyboard manufacturers:
this rather lengthy document covers also the topic of special key combinations for generating Unicode chars, and goes into the nitty gritty of how Windows intercepts them, etc., also covering some undocumented features. So the above link might be helpful (and at least it's all in a single page).
As of MSDN, these links are probably good starting points:
Most helpful comment
I've been peeking at MSDN documentation on keyboard input; the whole issue seems complicated by the fact that Alt codes work partly due to the keyboard (hardware + driver) itself, and partly due to how the WinAPI interprets these "virtual key" sequences.
What I did find, though, is a very interesting document by keyboard manufacturers:
this rather lengthy document covers also the topic of special key combinations for generating Unicode chars, and goes into the nitty gritty of how Windows intercepts them, etc., also covering some undocumented features. So the above link might be helpful (and at least it's all in a single page).
As of MSDN, these links are probably good starting points: