-
Notifications
You must be signed in to change notification settings - Fork 25
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 unicode? #10
Comments
maybe something like this: https://github.com/enthus1ast/illwill/blob/unicode/illwill.nim |
+1, this would also enable easy async text input like GLFW's char callback. |
i was thinking about this, and i'll try to explain my thoughts in another issue. There are other issues with the current Maybe its a good idea to deprecate getKey in favor of a I'll try to get a pr done when the mouse one is merged. |
Yeah, I haven't really investigated the UTF-8 issue to be honest. I was just happy to get it working with an English layout. If you can get this working reliably on all platforms, then yeah why not! Also a reminder, keyrepeat needs to work properly. From memory, UTF-8 handling with the standard windows terminal is a bit of a nightmare, so good luck :) |
@johnnovak the good thing is the mouse pr already implements the windows console input (in fact the code already captures all events, but filters them for only mouse events). |
@enthus1ast Yeah from memory using the windows console directly is the way to go (as opposed to stdin/stdout). |
sorry @johnnovak i'm busy with other projects right now, but maybe when the time comes :) |
@enthus1ast sure :) btw, i don't need unicode myself, i'm happy with latin1, but i can see why it can be a problem with German letters. a PR is welcome whenever you get around to doing it :) |
@johnnovak any feelings about pulling in winim? |
@johnnovak what do you think, should i upgrade getKey to also handle unicode or introduce a completely new getInput proc (that does mouse, unicode, old Key styles, maybe even modifiers) |
If you are planning to do such thing, think long and hard first whether you're willing to implement Unicode support properly for Windows, Linux & Mac. |
what i'm currently aiming for is: that it do not crash cmd.exe when typing non ascii eg: öäü keep the old api (getKey) working if you wish and/or i could deprecate it the new api currently looks like this: type KeyUnicode* = tuple[key: Key, rune: string] the Another thing i would like to change, is the modifier keys reporting. type Modifier = object
ctrl*: bool ## ctrl was down on event
shift*: bool ## shift was down on event the downside of this is, that you then cannot have a big case that reacts on CtrlA, I have to check if posix can report both at the same time. Another good addition would be, to also let illwill report resize events. What do you think? |
@enthus1ast Did you manage to solve the umlaut problem in your fork? I'm new to nim, but I like it. My very first project should be a simple directory chooser command-line utility. I understand that @johnnovak isn't eager to solve this. But did you solve it? I tried the illwill program showing the key names. I also tried |
Yes the terminal crashes. Have a look at this branch: there i was working on unicode, but i do not know in which state i left it. If you like you could try it and maybe fork it. Edit: Basically the windows "mouse code" is where all events are captured, they're just filtered for mouse stuff. Edit2: I got a little sloppy with the unicode branch(es) because i lost some uncommited code in a notebook crash, then swapped the notebooks a few times. |
OK (I'm the same person), I'll take a look at it. |
If anyone wants to solve this, the solution must be cross-platform and work equally well on Linux and macOS in addition to Windows if you want it to get merged. I haven't used the library for years now, so it won't be coming from me in foreseeable future, but happy to receive PRs. |
it would be nice when illwill also supports unicode.
Looking at the (posix) code part it also could be simple to capture them
eg:
https://www.utf8-chartable.de/
the german letter: "Ö" is encoded as 195.int 150.int
and the current
getKeyAsync
captures it correctly asbut since the current
getKeyAsync
returns aKey
it will not compose properly.Maybe implement a
function that has the representation of the key in the
rune
string?The inputSeq IS the correct rune!
The text was updated successfully, but these errors were encountered: