Post

Replies

Boosts

Views

Activity

Reply to Detecting marked range in UI/NSTextViews at the time of shouldChangeTextIn
Thanks for the suggestion. Unfortunately, using textInputMode to infer whether the current input will involve marked text doesn’t seem to be perfect. For Japanese input sources, this generally works in practice, except for certain cases such as emoji input. However, marked text can also appear even when the selected input source is English. For example, entering accented characters can involve marked text (e.g. Option+e produces "´", then typing "a" results in "á", where "´" is marked). In addition, the shouldChangeTextIn method is called not only during text input but also during undo operations or Writing Tools operations, where even kana characters are not marked. For these reasons, the input source alone can’t reliably indicate whether marked text is involved. That said, in the AppKit case, similar information can be obtained via NSTextView.inputContext?.selectedKeyboardInputSource. Is it correct to treat this as the AppKit equivalent of textInputMode?
Topic: UI Frameworks SubTopic: UIKit Tags:
3w