Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-58063

Android+Gboard: Input method confusion when activating input panel in middle of word

    XMLWordPrintable

Details

    • Android
    • 8ea3300a0862320259614dbb7387b2353a04e7e1 (qt/qtbase/5.12)

    Description

      On an Android 6.0 device with the preinstalled Gboard input method, I observe the following, which is reproducible in the lineedits example:

      (Using <...> to mark composing region, | to mark the cursor)

      • Enter a few words in the line edit. E.g. with English language keyboard:
        "Hello world"
      • Move focus to another element, so that the line edit looses focus (e.g. mode combobox in lineedits example).
      • Now when activating the input panel by clicking in the middle of word (other than the first word), the composing region is initially set to the word, and the cursor is initially positioned correctly. E.g. for click after "wo":
        "Hello <wo|rld>"
      • Immediatly after this, the composing region is moved (unexpectedly and incorrectly) to before the cursor, keeping its length, and now even spanning words, i.e.
        "Hel<lo wo|>rld"

      Now the input state is completely inconsistent: Other than indicated in the line edit, Gboard still retains the initial preedit string ("world"), suggesting "world", "works", "world's". But the next input will replace the composing region as indicicated by Qt:

      • Selecting suggestion "world" will end composing, but not change the text in the line edit. The cursor remains at its position:
        "Hello wo|rld"
      • Alternatively, selecting suggestion "works" will replace the composing region:
        "Helworks|rld"
      • Alternatively, selecting another letter will compose the new preedit string from the initial preedit string and this letter. E.g. for 'x':
        "Hel<worldx|>rld"

      Note that this is not reproducible with the input method of the Android emulator images, and even with Gboard it does not happen in rare cases.

      From tracing the events in my custom editor widget, I would say that the incorrect move of the input region is the effect of a call to QAndroidInputContext::setComposingRegion() which will in turn

      • first call finishComposing()
      • determine and set the new preedit text from the widget's text

      thus being vulnerable to possibly deviate from the preedit text in Android's input method as normally received via QAndroidInputContext::setComposingText().

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            esabraha Eskil Abrahamsen Blomfeldt
            dg0yt Kai Pastor
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes