Merge "Handle emojis with emoji-modifier and zwj properly on backspace"

This commit is contained in:
Koki Ryu
2022-10-28 01:55:30 +00:00
committed by Android (Google) Code Review
2 changed files with 7 additions and 1 deletions

View File

@@ -229,6 +229,8 @@ public abstract class BaseKeyListener extends MetaKeyKeyListener
break;
} else if (Emoji.isEmojiModifierBase(codePoint)) {
deleteCharCount += Character.charCount(codePoint);
state = STATE_BEFORE_EMOJI;
break;
}
state = STATE_FINISHED;
break;

View File

@@ -193,11 +193,15 @@ public class BackspaceTest {
backspace(state, 0);
state.assertEquals("|");
// Emoji modifier can be appended to the first emoji.
// Emoji modifier can be appended to each emoji.
state.setByString("U+1F469 U+1F3FB U+200D U+1F4BC |");
backspace(state, 0);
state.assertEquals("|");
state.setByString("U+1F468 U+1F3FF U+200D U+2764 U+FE0F U+200D U+1F468 U+1F3FB |");
backspace(state, 0);
state.assertEquals("|");
// End with ZERO WIDTH JOINER
state.setByString("U+1F441 U+200D |");
backspace(state, 0);