File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -59,16 +59,18 @@ final class TextLayoutInfoProvider {
5959 guard usedRect. contains ( point) else { return nil }
6060 let index = self . layoutManager. glyphIndex ( for: point, in: self . textContainer)
6161 #if compiler(>=5)
62+ let bridgedString = self . textStorage. string + " "
6263 return String . Index ( utf16Offset: index,
63- in: self . textStorage . string )
64+ in: bridgedString )
6465 #else
6566 return String . Index ( encodedOffset: index)
6667 #endif
6768 }
6869
6970 func rect( forRange range: Range < String . Index > ) -> CGRect {
7071 var result : CGRect ?
71- let nsRange = NSRange ( range, in: self . textStorage. string)
72+ let bridgedString = self . textStorage. string + " "
73+ let nsRange = NSRange ( range, in: bridgedString)
7274 self . layoutManager. enumerateEnclosingRects (
7375 forGlyphRange: nsRange,
7476 withinSelectedGlyphRange: . empty,
You can’t perform that action at this time.
0 commit comments