File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -297,6 +297,10 @@ extension String.CharacterView : BidirectionalCollection {
297
297
internal static func _internalExtraCheckGraphemeBreakBetween(
298
298
_ lhs: UInt16 , _ rhs: UInt16
299
299
) -> Bool {
300
+ _sanityCheck (
301
+ lhs != _CR || rhs != _LF,
302
+ " CR-LF special case handled by _quickCheckGraphemeBreakBetween " )
303
+
300
304
// Whether the given scalar, when it appears paired with another scalar
301
305
// satisfying this property, has a grapheme break between it and the other
302
306
// scalar.
@@ -316,10 +320,10 @@ extension String.CharacterView : BidirectionalCollection {
316
320
// Repeat sub-300 check, this is beneficial for common cases of Latin
317
321
// characters embedded within non-Latin script (e.g. newlines, spaces,
318
322
// proper nouns and/or jargon, punctuation).
319
- case 0x0000 ... 0x02ff :
320
- // Conservatively exclude CR, though this might not be necessary from
321
- // previous checks.
322
- return x != _CR
323
+ //
324
+ // NOTE: CR-LF special case has already been checked.
325
+ case 0x0000 ... 0x02ff : return true
326
+
323
327
// TODO: general punctuation
324
328
325
329
// Non-combining kana:
You can’t perform that action at this time.
0 commit comments