Fix issue 23250 - corrected reginal indicator pairing.

This commit is contained in:
Ate Eskola 2022-07-15 16:53:51 +03:00
parent 494b318c0a
commit 95d19d97ac

View file

@ -7032,9 +7032,7 @@ template genericDecodeGrapheme(bool getValue)
case RI: case RI:
if (isRegionalIndicator(ch)) if (isRegionalIndicator(ch))
mixin(eat); mixin(eat);
else
goto L_End_Extend; goto L_End_Extend;
break;
case L: case L:
if (isHangL(ch)) if (isHangL(ch))
mixin(eat); mixin(eat);
@ -7153,6 +7151,7 @@ if (isInputRange!Input && is(immutable ElementType!Input == immutable dchar))
@safe unittest @safe unittest
{ {
import std.algorithm.comparison : equal; import std.algorithm.comparison : equal;
debug import std.stdio;
Grapheme gr; Grapheme gr;
string s = " \u0020\u0308 "; string s = " \u0020\u0308 ";
@ -7166,6 +7165,10 @@ if (isInputRange!Input && is(immutable ElementType!Input == immutable dchar))
s = "\u11A8\u0308\uAC01"; s = "\u11A8\u0308\uAC01";
assert(equal(decodeGrapheme(s)[], "\u11A8\u0308")); assert(equal(decodeGrapheme(s)[], "\u11A8\u0308"));
assert(equal(decodeGrapheme(s)[], "\uAC01")); assert(equal(decodeGrapheme(s)[], "\uAC01"));
// Two Union Jacks of the Great Britain
s = "\U0001F1EC\U0001F1E7\U0001F1EC\U0001F1E7";
assert(equal(decodeGrapheme(s)[], "\U0001F1EC\U0001F1E7"));
} }
/++ /++