keymanapp / keyman

Keyman cross platform input methods system running on Android, iOS, Linux, macOS, Windows and mobile and desktop web
https://keyman.com/
Other
372 stars 102 forks source link

fix(android/engine): Skip updating selection range if invalid #11384

Closed darcywong00 closed 1 week ago

darcywong00 commented 1 week ago

Fixes #11360

@mcdurdin went spelunking in the Android code and found getSelectionStart() and getSelectionEnd() return -1 if there's no selection or cursor. Reference https://developer.android.com/reference/android/text/Selection#getSelectionEnd(java.lang.CharSequence

In those cases (likely a race condition), we should no-op on updateSelectionRange() since there's no valid selection to pass to KeymanWeb.

User Testing (from #11360)

Setup - Install PR build of Keyman for Android and enable Keyman as the default system keyboard

keymanapp-test-bot[bot] commented 1 week ago

User Test Results

Test specification and instructions

Test Artifacts

dinakaranr commented 1 week ago

Test Results

Note: The reverse text selection does not happen from one point to another. It's restricted to the last letter of the word. I observed this behavior in Android 13 (Physical Device) and emulator devices in Android 9 and 12 versions. However, it worked well, and I passed this test case. Thanks.

keyman-server commented 1 week ago

Changes in this pull request will be available for download in Keyman version 17.0.321-beta