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
Support OS language switch #210
Comments
Probably related to #125 |
I would love some advice for how best to solve this. I'm incredibly frustrated with my options at the moment. The full backstory is long and tired, but the basic gist is that sdl2 (the cross platform windowing library I am using) has two modes for getting keyboard inputs: Keydown/KeyUp which gets non keyboard mapped keycodes. This event lets allows me to tell which key is pressed and which modifiers are held down, but does not transform the key to the correct keyboard layout mapped value. As an example: ctrl-shift-6 on a qwerty keyboard would be reported as ctrl-shift-6 using this method instead of ctrl-^. TextInput which transforms the key properly, but does not allow for modifiers that don't produce a unique value. As an example: shift-6 on qwerty would properly produce ^, but ctrl-shift-6 would produce no TextInput event. Given these two primitives, today neovide does the following here https://github.com/Kethku/neovide/blob/master/src/bridge/layouts/mod.rs#L102 If TextInput produced a text value, then shift is ignored (it is assumed that the textinput used it up), and modifiers are applied. This strategy is very unfortunate because it requires the user to set the correct keyboard layout in a global variable and it requires us to list every possible key combination in a giant file for every supported layout which is decidedly not crossplatform or layout compatible. If a user has a novel layout, they have to contribute it to the repo or they are out of luck. Unfortunately I don't currently see a way out of this. I would LOVE any hint or advice for how to fix this. At this point I'm out of ideas. |
As for the exact issue here, the D- means that the windows key is held down. I believe this is fixed in the current master, but not the released version of the app. Please build from source |
Looks like you use kind of "scan codes" instead of characters and I am not sure if there is a simple/easy way to get real chars out of scan codes. So I can see the following routes:
Not sure if SDL has char input you can use: https://forums.libsdl.org/viewtopic.php?p=51153 |
The character input is handled by the TextInput events I described. These can't be used for everything because they are not raised if modifiers outside of those necessary for producing the initial character are held down. So shift-6 produces ^ but ctrl-shift-6 does not. |
Sorry not an expert :(, and don't know rust But if I press Like, |
It doesn't. No textinput event is raised because of a limitation in sdl2. I brought up the issue with the sdl2 team and they ignored my concerns even with repeated attempts to describe the problem. So at this point I'm out of luck |
For background this is the conversation I had: https://bugzilla.libsdl.org/show_bug.cgi?id=5029 |
This issue also breaks using |
closing in favor of #445 |
Currently when I try to switch language and input some russian text I get something different.
And then If I switch back to english it continues "weirdness":
The text was updated successfully, but these errors were encountered: