-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
Description
TypeAlias "ICB" = "Inline Composition Buffer" = "Inline PreEdit"
Both _selected_range and _replacement_range parameters are ignored in NSTextInputClient implementation. This causes an issue that these parameters sent from IME to IMKTextInput APIs are completely neglected:
winit/src/platform_impl/macos/view.rs
Line 321 in 44aabdd
| Some((preedit_string.len(), preedit_string.len())) |
These parameters are crucial for some IMEs utilizing nested inline composition buffers (i.e. nested preedits). E.g. The Traditional Chinese Zhuyin IME shipped in macOS. In-ICB cursor is of vital necessity for these IMEs.
Note: These parameters are UTF16 ranges. Apple introduced these APIs in macOS 10.5 Leopard. See the IMKTextInput API header for more intelligence: https://github.com/phracker/MacOSX-SDKs/blob/041600eda65c6a668f66cb7d56b7d1da3e8bcc93/MacOSX10.5.sdk/System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/Headers/IMKInputSession.h#L74-L85
I was about to send a PR to fix this issue. However, I have to figure out one thing:
In src/events.rs, search pub enum Ime and find Preedit(String, Option<(usize, usize)>),. I have doubts about this property: Are these cursor positions supposed to be utf8 or utf16? This has to be figured out prior to patching this issue.
macOS version
ProductName: macOS
ProductVersion: 14.4.1
BuildVersion: 23E224Winit version
Master Branch 44aabdd