Skip to content

Commit

Permalink
Fix Hidden Cursor At End Of Doc (#39)
Browse files Browse the repository at this point in the history
  • Loading branch information
thecoolwinter authored Jun 18, 2024
1 parent 9e6d94a commit 40458fe
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -233,12 +233,15 @@ public class TextSelectionManager: NSObject {
/// - Parameter range: The range the cursor is at.
/// - Returns: The height the cursor should be to match the text at that location.
fileprivate func heightForCursorAt(_ range: NSRange) -> CGFloat? {
let selectedLine = layoutManager?.textLineForOffset(range.location)
return selectedLine?
guard let selectedLine = layoutManager?.textLineForOffset(range.location) else {
return layoutManager?.estimateLineHeight()
}
return selectedLine
.data
.lineFragments
.getLine(atOffset: range.location - (selectedLine?.range.location ?? 0))?
.getLine(atOffset: range.location - (selectedLine.range.location))?
.height
?? layoutManager?.estimateLineHeight()

}

Expand Down

0 comments on commit 40458fe

Please sign in to comment.