-
Notifications
You must be signed in to change notification settings - Fork 948
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
incorrectly handle insertText (macOS) #3925
Comments
I think this might additionally explain the following two bugs (just based on the symptoms, so I might be wrong) |
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.
That's the reason you have And no, checking for e.g. ASCII is also wrong, since Russian layout shouldn't go through IME. |
what's the status of this pr? |
@lifei No progress. I don't have an idea yet. I guess the correct way forward is to reinterpret system results as key events rather than OTOH, if the client app is willing to indicate whether it wants keys or text by calling |
You can still deliver normal |
@fredizzimo Yep, I'm aware of that. The current version behaves that way by heuristically deciding whether to send key events to IME. I'll try to summarize the problem here:
To winit, without a hint from the app itself, we cannot tell with certainty if the key event should be directly forwarded to the app, or it is the text from IME should be sent to the app. The root problem is due to winit distinguishing between the two, which may make sense for Windows or Linux (I don't know) but definitely causes some problems for macOS. |
I'm pretty sure it's possible to fix this, since the sequence should be generally different, but given that I'm not that interested myself in figuring out macOS nor apple allows me to use newer versions, I'm not that much interested myself. The thing is that certain characters which don't work have likely a special pattern, since they are not being inserted in a normal way at all IIRC, so figuring that pattern out is how it should be done. I know that maybe |
I also don't see any issue in e.g. looking into how firefox builds the sequence and how it deals with the IME input, or e.g. chrome. I'm sure they should have the same issue and probably solved it somehow. |
Description
Description
Currently, the implementation of
insertText
is insufficient to cover some input methods that can commit text without setting a preedit. (e.g. when the input method translates a certain key and directly commits the translation.)Known affected downstream programs include Alacritty and Neovide.
Examples
。
to the program without ever setting a preedit.a
directly commitsあ
without any preedit. Currently, both full-width punctuation and SKK Japanese input method doesn't work properly.Analysis
Upon inspection, I found that
insertText
will only commit text when there is a preedit. (Hence the description above.)I removed the condition and it almost worked for me. However, it seems to be added in commit 3fd7384 for a good reason.
winit/src/platform_impl/apple/appkit/view.rs
Lines 406 to 411 in 7e819bb
Notes
By "almost" above, I mean it's still not fully satisfactory.
Ground
to be the default. But I might be missing some details here.)q
, the input method can receiveq
(toggling katagana) and anotherq
will also be forwarded to the application.Another thing is that I noticed the system input methods can commit full-width punctuation just fine. But to my surprise I didn't manage to find any difference in the logs. So I don't really understand what's going on.
macOS version
Winit version
0.30.3
The text was updated successfully, but these errors were encountered: