-
-
Notifications
You must be signed in to change notification settings - Fork 111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(android): handle surrogate pairs in selection range indexing #10885
Conversation
User Test ResultsTest specification and instructions
Test Artifacts |
android/KMEA/app/src/main/java/com/keyman/engine/KMKeyboard.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should check icText != null before getting the text.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Changes in this pull request will be available for download in Keyman version 17.0.280-beta |
Fixes an issue noted while validating #10873.
This change prevents backspaces and context-deletions from keyboard rules from mishandling the context after moving the text insertion point and/or selecting text.
Recent changes to the codebase have resulted in a need to consistently specify selection ranges with non-BMP indexing. #10662 recognized the need to keep non-BMP processing enabled as part of a different Android bug fix, and #10728 took things a bit further (for iOS) while further validating this position. Until now... we missed that Android was actually specifying the selection range with code unit (BMP) indexing, which does not account for surrogate pairs.
User Testing
TEST_POST_EMOJI_ROTATION:
Go to https://jahorton.github.io/ and download the test_robust_deletions.kmp package.
Alternatively, scan this QR code for the package:
Enable Keyman as system keyboard.
Open the device's primary mail app (gmail). If prompted, attempt to sign in with a Gmail account.
Type just one of the emoji keys 4 times. (Do not exceed 7.)
Type
ggg
.Select
ggg
and hit backspace to delete it.Type
p
once, then continue typing it to verify that 'p' correctly rotates as follows, without affecting any other pre-existing text:- 'p' will rotate through:
p
,ṗ
,p̂
,p̂p̂
,p
, ...- The number of code points are: 1, 2, 2, 4, 1, ...
- One backspace should delete one codepoint; therefore, to delete
p̂p̂
completely should take 4 backspaces.