Skip to content

Both _selected_range and _replacement_range parameters are ignored in NSTextInputClient implementation. #3617

@ShikiSuen

Description

@ShikiSuen

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:

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.

image

macOS version

ProductName:		macOS
ProductVersion:		14.4.1
BuildVersion:		23E224

Winit version

Master Branch 44aabdd

Metadata

Metadata

Assignees

No one assigned

    Labels

    B - bugDang, that shouldn't have happenedDS - appkitAffects the AppKit/macOS backend

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions