fix(android): Fix length used in context before restoring characters

This fixes a test scenario involving 6 emojis (SMP characters) and the p^p^ context.

A backspace was removing an entire p^ grapheme. This fixes the contents of `newContext` that is used to determine the character sequence to restore
This commit is contained in:
Darcy Wong 2019-11-25 13:52:49 +07:00
parent b452c57688
commit 091ed93b24

View file

@ -2096,7 +2096,7 @@ public final class KMManager {
// subSequence indices are start(inclusive) to end(exclusive)
CharSequence expectedChars = charsBackup.subSequence(0, charsBackup.length() - (dn + numPairs));
ic.deleteSurroundingText(dn + numPairs, 0);
CharSequence newContext = getCharacterSequence(ic, originalBufferLength - dn);
CharSequence newContext = getCharacterSequence(ic, originalBufferLength - 2*dn);
CharSequence charsToRestore = CharSequenceUtil.restoreChars(expectedChars, newContext);
if (charsToRestore.length() > 0) {