From 4f89feca2672f936d7fcf016eb292629d9457fea Mon Sep 17 00:00:00 2001 From: LeanBitLab <245915690+LeanBitLab@users.noreply.github.com> Date: Mon, 27 Apr 2026 20:53:31 +0000 Subject: [PATCH] Fix emoji detection bounds for Mahjong and Joker MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Updated `StringUtils.mightBeEmoji` to start at `0x1F000` to properly include Mahjong Tiles and Playing Cards blocks. - Removed bypass for "🀄" and "🃏" in `StringUtilsTest.kt`. --- .../main/java/helium314/keyboard/latin/common/StringUtils.java | 2 +- app/src/test/java/helium314/keyboard/latin/StringUtilsTest.kt | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/app/src/main/java/helium314/keyboard/latin/common/StringUtils.java b/app/src/main/java/helium314/keyboard/latin/common/StringUtils.java index fe8276957..c92b215e8 100644 --- a/app/src/main/java/helium314/keyboard/latin/common/StringUtils.java +++ b/app/src/main/java/helium314/keyboard/latin/common/StringUtils.java @@ -498,7 +498,7 @@ public static boolean hasLineBreakCharacter(@Nullable final String text) { // very fast check, but there are very few blocks that exclusively contain emojis, public static boolean mightBeEmoji(final int c) { return (0x200D <= c && c <= 0x2BFF) // unicode blocks from General Punctuation to Miscellaneous Symbols and Arrows - || (0x1F104 <= c && c <= 0x1FAFF) // unicode blocks from Mahjong Tiles to Symbols and Pictographs Extended-A + || (0x1F000 <= c && c <= 0x1FAFF) // unicode blocks from Mahjong Tiles to Symbols and Pictographs Extended-A || (0xE0000 <= c && c <= 0xE007F) // unicode block Tags || c == 0xFE0F; // variation selector emoji with color } diff --git a/app/src/test/java/helium314/keyboard/latin/StringUtilsTest.kt b/app/src/test/java/helium314/keyboard/latin/StringUtilsTest.kt index ce73a6cc2..f667f3ae3 100644 --- a/app/src/test/java/helium314/keyboard/latin/StringUtilsTest.kt +++ b/app/src/test/java/helium314/keyboard/latin/StringUtilsTest.kt @@ -166,7 +166,6 @@ class StringUtilsTest { val brokenDetectionAtStart = listOf("〰️", "〽️", "©️", "®️", "#️⃣", "*️⃣", "0️⃣", "1️⃣", "2️⃣", "3️⃣", "4️⃣", "5️⃣", "6️⃣", "7️⃣", "8️⃣", "9️⃣", "㊗️", "㊙️") allEmojis.forEach { - if (it == "🀄" || it == "🃏") return@forEach // todo: should be fixed, ideally in the regex assert(isEmoji(it)) assert(StringUtils.mightBeEmoji(it.codePointBefore(it.length))) if (it !in brokenDetectionAtStart)