macOS: improve IME state management - #4087
Conversation
fixes rust-windowing#3925 on macOS, when IME is allowed, always send text to IME and use that result when possible. Even if the keyboard is a simple one, like US keyboard. Committed text is now inserted regardless of the presence of a preedit.
|
I'm unable to test this myself, but it should probably mark #3814 as fixed too. |
madsmtm
left a comment
There was a problem hiding this comment.
I hate our IME code with passion (another way of say I don't understand it at all ;) ), and will defer to Kirill's judgement as to whether this is a good idea or not. On the surface it looks fine.
kchibisov
left a comment
There was a problem hiding this comment.
All regular input now goes though IME, which is wrong. You can see that every character is going through Ime::Commit and not through regular keyboard input, thus nothing really works anymore when it comes to bindings and key combinations.
Regular input shouldn't go through IME.
|
Hmmm, then things are much more complicated. How about enable IME only when a text entry is focused? Another way is perhaps to handle all shortcuts in |
|
What text entry when we have none of that, so it won't really help as you can see? Like the issue is that normal input is not being sent at all. I'd suggest to figure out why punctuation is not sent in the first place, like there's clearly a case with the old code that makes it ignored, which should likely be changed to |
|
what's the status of this issue? |
|
Someone with macOS should figure out how to make it work, so it doesn't blow up all over the place. The comment I stated above still applies. |
|
Thing here: 👇
So, it's ok when fixing IME, it's also ok when fixing GUI framework… |
|
I mean the point is not that there's no issue on our side, it's just someone should solve it in a way that is not distractable, by stating more that there's an issue, you don't help anyone, since we know that information. The issue is who can write code in a way that it works, arguing won't go anywhere. You may provide guidance on how to fix it, so one could pick it up, but any discussion that is not around how to write code won't really move anything. |
|
wezterm/wezterm@180a991 👈 similar commit in wezterm, hope helpful. I can't write Rust and have no knowledge of macOS GUI programming. Maybe using AI can help you guys to better understand the code. |
|
it's irrelevant though to us. The problem is that all macOS stuff (IME as well) is reverse engineering pretty much. If you don't know what you're talking about, then please, don't make an extra noise here for everyone else. |
|
@lifei Mentioning Apple IME (the macOS Built-in Simplified-Chinese Pinyin IME (macOS 26)) is not helpful at all. Despite that the Please always use Sogou IME or WeChat IME to test this. Test results using RIME Squirrel may vary depending on what input schema is loaded in RIME. |
|
I think this is superseded by #4651, hence closing. |
changelogmodule if knowledge of this change could be valuable to usersFixes #3925
Fixes #3814
The basic idea of this change is: when IME is allowed, we always forward key events to the IME first, and use the result from the IME. Simpler keyboards, like the US keyboard, is also correctly supported by this.
Summary of changes:
Ime::Enabledwhenset_ime_allowed(true). Do not manage it elsewhere. This is a huge simplification, and it should be harmless to current conforming applications.What is improved:
q(toggles katakana) should work properly. Previously, SKK is not usable at all.(Korean IMEs work mostly fine but #3095 is not fixed by this PR: the first key will generate a call to
insertText:instead ofsetMarkedText:, which seems unrelated to the problems this PR tries to fix.)