src/vs/base/common/strings.ts/nextCharLength
export function nextCharLength(str: string, offset: number): number {
	const graphemeBreakTree = GraphemeBreakTree.getInstance();
	const initialOffset = offset;
	const len = str.length;

	const initialCodePoint = getNextCodePoint(str, len, offset);
	offset += (initialCodePoint >= Constants.UNICODE_SUPPLEMENTARY_PLANE_BEGIN ? 2 : 1);

	let graphemeBreakType = graphemeBreakTree.getGraphemeBreakType(initialCodePoint);
	while (offset < len) {
		const nextCodePoint = getNextCodePoint(str, len, offset);
		const nextGraphemeBreakType = graphemeBreakTree.getGraphemeBreakType(nextCodePoint);
		if (breakBetweenGraphemeBreakType(graphemeBreakType, nextGraphemeBreakType)) {
			break;
		}
		offset += (nextCodePoint >= Constants.UNICODE_SUPPLEMENTARY_PLANE_BEGIN ? 2 : 1);
		graphemeBreakType = nextGraphemeBreakType;
	}

	return (offset - initialOffset);
}