Skip to content

Fix Hidden Cursor At End Of Doc #39

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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