Skip to content

Restore standalone regional indicators at the end of the flags category - #2682

Open
MiMoHo wants to merge 5 commits into
HeliBorg:mainfrom
MiMoHo:restore-regional-indicators
Open

Restore standalone regional indicators at the end of the flags category#2682
MiMoHo wants to merge 5 commits into
HeliBorg:mainfrom
MiMoHo:restore-regional-indicators

Conversation

@MiMoHo

@MiMoHo MiMoHo commented Jul 20, 2026

Copy link
Copy Markdown

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.

Verified by running make-emoji-keys into a scratch directory: the generated FLAGS.txt, SYMBOLS.txt, and minApi.txt are 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.

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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you have the isSingleRegionalIndicator check separate from isSingleGrapheme? Should the letters really be an emoji, but not a single grapheme?

@Helium314

Copy link
Copy Markdown
Collaborator

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.

MiMoHo and others added 2 commits July 21, 2026 21:14
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>
@MiMoHo

MiMoHo commented Jul 21, 2026

Copy link
Copy Markdown
Author

@Helium314 it is generated — the reason you got no letters is that the makeEmoji task never rebuilt the jar, so it ran old code.

dependsOn['jar'] in tools/make-emoji-keys/build.gradle is a subscript, not an actual task dependency, so makeEmoji just uses whatever jar is already lying around (or fails if there is none). A jar built before my change doesn't have the letters.

The letters come from EmojiData.appendRegionalIndicators(), called once in MakeEmojiKeys: it adds U+1F1E6–1F1FF to the flags group after parsing, since emoji-test.txt only has the composed flags. The API 19 entries went into android-emoji-support.txt.

I pushed two fixes: dependsOn jar so the task rebuilds first, and I removed a stray trailing newline my earlier commit had left in FLAGS.txt. Now ./gradlew tools:make-emoji-keys:makeEmoji reproduces the file exactly — git diff stays empty.

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.

@Helium314

Copy link
Copy Markdown
Collaborator

the reason you got no letters is that the makeEmoji task never rebuilt the jar, so it ran old code.

Ah thanks! Using it so rarely that I didn't remember.

dependsOn jar so the task rebuilds first

Thanks, that should make sure I won't run into this issue again.
I'd say it's related and simple enough to be in this PR.

So the only thing left is the question whether a standalone regional indicator should count for isSingleGrapheme.
I'd say yes, but maybe you have a good reason for having it the way it is.

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>
@MiMoHo

MiMoHo commented Jul 22, 2026

Copy link
Copy Markdown
Author

Agreed @Helium314 — no good reason, it was just an oversight. A standalone regional indicator is a single code point / single grapheme; isSingleGrapheme only returned false because the cheap '\uD83C' !in this skin-tone guard also catches the indicator's high surrogate, so it fell through to singleEmojiRegex, which only matches indicator pairs.

Fixed by short-circuiting the standalone case in isSingleGrapheme (reusing the isSingleRegionalIndicator helper) and added it to the singleGrapheme test. The isEmoji short-circuit still has to stay, though, for the same regex reason — singleEmojiRegex won't match a lone indicator.

Pushed as c31e4b4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add standalone Regional Indicator Symbols (🇦–🇿) to the emoji keyboard

2 participants