src/vs/base/common/strings.ts/breakBetweenGraphemeBreakType
function breakBetweenGraphemeBreakType(breakTypeA: GraphemeBreakType, breakTypeB: GraphemeBreakType): boolean {
	// http://www.unicode.org/reports/tr29/#Grapheme_Cluster_Boundary_Rules

	// !!! Let's make the common case a bit faster
	if (breakTypeA === GraphemeBreakType.Other) {
		// see https://www.unicode.org/Public/13.0.0/ucd/auxiliary/GraphemeBreakTest-13.0.0d10.html#table
		return (breakTypeB !== GraphemeBreakType.Extend && breakTypeB !== GraphemeBreakType.SpacingMark);
	}

	// Do not break between a CR and LF. Otherwise, break before and after controls.
	// GB3                                        CR × LF
	// GB4                       (Control | CR | LF) ÷
	// GB5                                           ÷ (Control | CR | LF)
	if (breakTypeA === GraphemeBreakType.CR) {
		if (breakTypeB === GraphemeBreakType.LF) {
			return false; // GB3
		}
	}
	if (breakTypeA === GraphemeBreakType.Control || breakTypeA === GraphemeBreakType.CR || breakTypeA === GraphemeBreakType.LF) {
		return true; // GB4
	}
	if (breakTypeB === GraphemeBreakType.Control || breakTypeB === GraphemeBreakType.CR || breakTypeB === GraphemeBreakType.LF) {
		return true; // GB5
	}

	// Do not break Hangul syllable sequences.
	// GB6                                         L × (L | V | LV | LVT)
	// GB7                                  (LV | V) × (V | T)
	// GB8                                 (LVT | T) × T
	if (breakTypeA === GraphemeBreakType.L) {
		if (breakTypeB === GraphemeBreakType.L || breakTypeB === GraphemeBreakType.V || breakTypeB === GraphemeBreakType.LV || breakTypeB === GraphemeBreakType.LVT) {
			return false; // GB6
		}
	}
	if (breakTypeA === GraphemeBreakType.LV || breakTypeA === GraphemeBreakType.V) {
		if (breakTypeB === GraphemeBreakType.V || breakTypeB === GraphemeBreakType.T) {
			return false; // GB7
		}
	}
	if (breakTypeA === GraphemeBreakType.LVT || breakTypeA === GraphemeBreakType.T) {
		if (breakTypeB === GraphemeBreakType.T) {
			return false; // GB8
		}
	}

	// Do not break before extending characters or ZWJ.
	// GB9                                           × (Extend | ZWJ)
	if (breakTypeB === GraphemeBreakType.Extend || breakTypeB === GraphemeBreakType.ZWJ) {
		return false; // GB9
	}

	// The GB9a and GB9b rules only apply to extended grapheme clusters:
	// Do not break before SpacingMarks, or after Prepend characters.
	// GB9a                                          × SpacingMark
	// GB9b                                  Prepend ×
	if (breakTypeB === GraphemeBreakType.SpacingMark) {
		return false; // GB9a
	}
	if (breakTypeA === GraphemeBreakType.Prepend) {
		return false; // GB9b
	}

	// Do not break within emoji modifier sequences or emoji zwj sequences.
	// GB11    \p{Extended_Pictographic} Extend* ZWJ × \p{Extended_Pictographic}
	if (breakTypeA === GraphemeBreakType.ZWJ && breakTypeB === GraphemeBreakType.Extended_Pictographic) {
		// Note: we are not implementing the rule entirely here to avoid introducing states
		return false; // GB11
	}

	// GB12                          sot (RI RI)* RI × RI
	// GB13                        [^RI] (RI RI)* RI × RI
	if (breakTypeA === GraphemeBreakType.Regional_Indicator && breakTypeB === GraphemeBreakType.Regional_Indicator) {
		// Note: we are not implementing the rule entirely here to avoid introducing states
		return false; // GB12 & GB13
	}

	// GB999                                     Any ÷ Any
	return true;
}