We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9714f97 commit b29d8f4Copy full SHA for b29d8f4
stdlib/public/core/StringGraphemeBreaking.swift
@@ -130,8 +130,13 @@ extension _StringGuts {
130
if i == bounds.lowerBound || i == bounds.upperBound { return i }
131
132
let offset = i._encodedOffset
133
- let prior = offset - _opaqueCharacterStride(endingAt: offset)
134
- let stride = _opaqueCharacterStride(startingAt: prior)
+
+ let offsetBounds = Range(
135
+ _uncheckedBounds: (
136
+ bounds.lowerBound._encodedOffset, bounds.upperBound._encodedOffset))
137
138
+ let prior = offset - _opaqueCharacterStride(endingAt: offset, in: offsetBounds)
139
+ let stride = _opaqueCharacterStride(startingAt: prior, in: offsetBounds)
140
_internalInvariant(offset <= prior + stride,
141
"Grapheme breaking inconsistency")
142
if offset >= prior + stride {
0 commit comments