-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Description
Description
When inputting text in languages that use multi-step input (composing mode), there are two ranges involved:
- The overall composing range
- The active subrange within the composing range
This is common when inputting text using ateji in Japanese, but occurs in general with longer composing ranges, person, and place names.
To support this, we'll need some visual highlighting of the text to make clear which range is the active subrange, as well as changes to the text input protocol so that the engine can specify this range to the framework. It seems unlikely to me that users will need to programmatically control the range via TextEditingController, so ideally the API surface should be as minimal as possible.
Repro steps and expected behaviour
For example, when inputting the name 真惟佳 (Maika), one would go through the following steps:
- Type the phonetic kana characters まいか.
- Press shift-left arrow to restrict the active subrange within the composing range to the first character, ま.
- Select the correct completion, then hit the right arrow to switch the active range to the remainder of the composing range. At this point the composing range reads 真いか and いか becomes the active subrange.
- Press shift-left arrow to restrict the active range to the second character only, then select the correct completion, then hit right arrow to switch the active range to the final character. The composing region now read 真惟か and か becomes the active subrange.
- Select the correct completion, then hit return to commit the composing region. The text 真惟佳 is now committed.
Visual representation
The composing region and active subrange are each visually highlighted to the user in some platform-specific way.
On macOS 11.0, Chrome, and Android, it is highlighted using a thicker underline with a small gap between it and the thinner composing region underline. In Linux GTK apps (and I believe older versions of macOS), the subrange is highlighted with a lighter colour than the standard selection colour.



