Skip to content
TypeScript

fix(shared): terminal labels after non-BMP letters stay plain text (#19968)

Karan Kumar3017eca6c880
diff --git a/packages/shared/src/composerContextLegacy.ts b/packages/shared/src/composerContextLegacy.ts
index 8bea672a06b..fb7f35d6eae 100644
--- a/packages/shared/src/composerContextLegacy.ts
+++ b/packages/shared/src/composerContextLegacy.ts
@@ -408,9 +408,12 @@ export function upgradeLegacyContextMessage(text: string): UpgradedLegacyContext
if (placedTerminals.has(record)) continue;
const label = inlineTerminalLabel(record);
let at = body.indexOf(label);
+ // Alternation instead of a character class: on Electron 44's V8 (15.2) a class
+ // directly before `$` with the `u` flag never matches a code point outside the
+ // BMP, so `𐐀@build:7` would become a chip (#18272).
while (
at !== -1 &&
- (/[\p{L}\p{N}\p{M}[email protected]]$/u.test(body.slice(0, at)) ||
+ (/(?:\p{L}|\p{N}|\p{M}|[[email protected]])$/u.test(body.slice(0, at)) ||
/^(?:[\p{L}\p{N}\p{M}_-]|[.@]+[\p{L}\p{N}\p{M}_-])/u.test(body.slice(at + label.length)))
) {
at = body.indexOf(label, at + 1);