File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
Sources/CodeEditTextView/TextSelectionManager Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -233,12 +233,15 @@ public class TextSelectionManager: NSObject {
233233 /// - Parameter range: The range the cursor is at.
234234 /// - Returns: The height the cursor should be to match the text at that location.
235235 fileprivate func heightForCursorAt( _ range: NSRange ) -> CGFloat ? {
236- let selectedLine = layoutManager? . textLineForOffset ( range. location)
237- return selectedLine?
236+ guard let selectedLine = layoutManager? . textLineForOffset ( range. location) else {
237+ return layoutManager? . estimateLineHeight ( )
238+ }
239+ return selectedLine
238240 . data
239241 . lineFragments
240- . getLine ( atOffset: range. location - ( selectedLine? . range. location ?? 0 ) ) ?
242+ . getLine ( atOffset: range. location - ( selectedLine. range. location) ) ?
241243 . height
244+ ?? layoutManager? . estimateLineHeight ( )
242245
243246 }
244247
You can’t perform that action at this time.
0 commit comments