Restore standalone regional indicators at the end of the flags category - #2682
Restore standalone regional indicators at the end of the flags category#2682MiMoHo wants to merge 5 commits into
Conversation
They were removed from the symbols group in 1680 with the agreement to restore them if requested (2627), preferably in the flags category: two of them in a row compose a country flag, so they sit next to what they build. Injected by the generator after parsing, since Unicode's emoji-test.txt only lists the composed flags; support entries restored in the API 19 section, so minApi.txt is unaffected. Verified by running make-emoji-keys into a scratch dir: output is byte-identical to the checked-in assets. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The RGI-based singleEmojiRegex only matches indicator pairs (country flags), and isSingleGrapheme falls back to that regex for strings containing 0xD83C, so a single indicator letter failed emoji detection (caught by StringUtilsTest.isEmojiDetectsAllAvailableEmojis once the indicators were back in the flags category). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
| // the standalone regional indicator check comes first because the RGI-based singleEmojiRegex only | ||
| // matches indicator pairs (country flags), and isSingleGrapheme falls back to that regex too, | ||
| // but the flags category also offers the standalone indicator letters | ||
| fun isEmoji(text: CharSequence): Boolean = text.isSingleRegionalIndicator |
There was a problem hiding this comment.
Why do you have the isSingleRegionalIndicator check separate from isSingleGrapheme? Should the letters really be an emoji, but not a single grapheme?
|
How did you update FLAGS:txt? When I run make-emoji-keys with your changes, I don't get any of the letters in the file. Further, please consider the guidelines: In such a very simple case as a revert with an updated check I'm ok with completely generated code, but I still want communication to happen between humans. |
make-emoji-keys writes each category file with joinToString("\n") and
emits no trailing newline (see the other category files and the flags
list on main, which end without one). The regional-indicator commit
added the 26 letters correctly but left a trailing newline behind, so
the checked-in file no longer matched the generator output byte-for-byte.
Regenerated so `makeEmoji` now leaves FLAGS.txt unchanged.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
`dependsOn['jar']` is a subscript on the dependsOn set, not a task
dependency, so `makeEmoji` never rebuilt the jar. With no jar present it
fails outright ("Unable to access jarfile ..."); with a stale one it
silently regenerates the assets from old code. Use `dependsOn jar` so the
task always runs against freshly compiled sources.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
@Helium314 it is generated — the reason you got no letters is that the
The letters come from I pushed two fixes: The build-script fix is a pre-existing bug, not really part of this PR. I can pull it into its own PR if you'd rather keep this one to just the revert. |
Ah thanks! Using it so rarely that I didn't remember.
Thanks, that should make sure I won't run into this issue again. So the only thing left is the question whether a standalone regional indicator should count for |
isSingleGrapheme returned false for a lone regional indicator (🇦–🇿) only because the cheap '\uD83C' skin-tone guard also catches the indicator's high surrogate, so it fell through to singleEmojiRegex, which matches indicator pairs (flags) only. Short-circuit the standalone case with the existing isSingleRegionalIndicator helper and cover it in the singleGrapheme test. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Agreed @Helium314 — no good reason, it was just an oversight. A standalone regional indicator is a single code point / single grapheme; Fixed by short-circuiting the standalone case in Pushed as c31e4b4 |
What
Restores the standalone Regional Indicator Symbols (🇦–🇿, U+1F1E6–U+1F1FF) that were removed in #1680 — but at the end of the Flags category instead of their old spot in Symbols, as suggested in the #1680 discussion ("maybe move them to flags"). Typing two of them in a row still composes a country flag, so Flags is also the semantically right home.
EmojiData.appendRegionalIndicators()injects them after parsing (they are not in Unicode's emoji-test.txt, which only lists the composed flags), called fromMakeEmojiKeys.main— simpler than the pre-Remove regional indicator symbol letters from emoji list #1680 injection that was keyed to the keycap-hash emoji.android-emoji-support.txt(API 19 section, where they were before Remove regional indicator symbol letters from emoji list #1680; nominApi.txtimpact since 19 < minSdk).assets/emoji/FLAGS.txtgets the 26 indicators appended.Verified by running
make-emoji-keysinto a scratch directory: the generatedFLAGS.txt,SYMBOLS.txt, andminApi.txtare byte-identical to the checked-in assets (modulo the generator's missing trailing newline).Why
Fixes #2627. In #1680 the removal was agreed with "remove them and revert (and maybe move them to flags) if someone wants them back" — #2627 is that request. Placing them at the bottom of Flags follows the suggestion made there, keeping them discoverable next to the flags they compose without cluttering Symbols.
Refs #1680.