Skip to main content

split_leading_emoji

Function split_leading_emoji 

Source
pub fn split_leading_emoji(subject: &str) -> &str
Expand description

Skip a leading emoji cluster.

The JS carried a ~2KB hand-maintained list of emoji codepoints, and had already been patched once because it matched only the BASE codepoint — leaving a stray variation selector (U+FE0F) between the emoji and the type, so a perfectly good ⬆️ chore: … was rejected as having no prefix.

Inverting the test removes that whole class of bug: a conventional type is ASCII lowercase letters, so skip anything that is NOT ASCII, plus spaces. Strictly more permissive than the codepoint list, and permissive in the harmless direction — the type itself is still required below, so this only decides how much leading decoration gets stripped before re-adding ours.