Skip to content

Active subrange within composing range should be visually highlighted in Flutter #68547

@cbracken

Description

@cbracken

Description

When inputting text in languages that use multi-step input (composing mode), there are two ranges involved:

  1. The overall composing range
  2. 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:

  1. Type the phonetic kana characters まいか.
  2. Press shift-left arrow to restrict the active subrange within the composing range to the first character, ま.
  3. 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.
  4. 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.
  5. 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.

macOS 11.0:
image

iPadOS 14.0:
image

Chrome on Linux:
image

Linux GTK apps:
image

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work lista: desktopRunning on desktopa: internationalizationSupporting other languages or locales. (aka i18n)a: text inputEntering text in a text field or keyboard related problemsengineflutter/engine related. See also e: labels.frameworkflutter/packages/flutter repository. See also f: labels.team-text-inputOwned by Text Input teamtriaged-text-inputTriaged by Text Input team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions