File tree 1 file changed +6
-3
lines changed
Sources/CodeEditTextView/TextSelectionManager
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 {
233
233
/// - Parameter range: The range the cursor is at.
234
234
/// - Returns: The height the cursor should be to match the text at that location.
235
235
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
238
240
. data
239
241
. lineFragments
240
- . getLine ( atOffset: range. location - ( selectedLine? . range. location ?? 0 ) ) ?
242
+ . getLine ( atOffset: range. location - ( selectedLine. range. location) ) ?
241
243
. height
244
+ ?? layoutManager? . estimateLineHeight ( )
242
245
243
246
}
244
247
You can’t perform that action at this time.
0 commit comments