Skip to content

Commit 6bd9201

Browse files
committed
fix(shared): terminal labels after non-BMP letters stay plain text
A one-character character class directly before `$` fails to match a code point outside the BMP on the V8 in our pinned Electron, so the boundary check in `composerContextLegacy.ts` returned false when the text before a terminal label ended in an astral letter. The label was then upgraded into a chip and the `𐐀@build:7` case failed on `main`. Rewrite the check as an alternation, which reads correctly on the affected engines, and record why it is not a class.
1 parent b67ac65 commit 6bd9201

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

‎packages/shared/src/composerContextLegacy.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,9 +418,12 @@ export function upgradeLegacyContextMessage(text: string): UpgradedLegacyContext
418418
if (placedTerminals.has(record)) continue;
419419
const label = inlineTerminalLabel(record);
420420
let at = body.indexOf(label);
421+
// The letter/digit test is an alternation rather than a character class: on the
422+
// V8 in our pinned Electron, a one-character class directly before `$` fails to
423+
// match a letter outside the BMP (see #18272), while this form reads correctly.
421424
while (
422425
at !== -1 &&
423-
(/[\p{L}\p{N}\p{M}_@.-]$/u.test(body.slice(0, at)) ||
426+
(/(?:\p{L}|\p{N}|\p{M}|[_@.-])$/u.test(body.slice(0, at)) ||
424427
/^(?:[\p{L}\p{N}\p{M}_-]|[.@]+[\p{L}\p{N}\p{M}_-])/u.test(body.slice(at + label.length)))
425428
) {
426429
at = body.indexOf(label, at + 1);

0 commit comments

Comments
 (0)