Skip to content

Commit

Permalink
[RSKPlaceholderTextView] [caretRect(for:)] [placeholderTextLayoutMana…
Browse files Browse the repository at this point in the history
…ger] Offset `caretRect.origin.x` by the value of `textContainer.lineFragmentPadding` on iOS below 17.0 so that the cursor position is the same.
  • Loading branch information
ruslanskorb committed Nov 30, 2023
1 parent 4b59229 commit 595eecf
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions RSKPlaceholderTextView/RSKPlaceholderTextView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -264,12 +264,20 @@ import UIKit

case .rightToLeft:
caretRect.origin.x = self.textContainerInset.left + layoutFragmentFrame.maxX
if #unavailable(iOS 17.0) {

caretRect.origin.x -= self.textContainer.lineFragmentPadding
}

case .leftToRight:
fallthrough

@unknown default:
caretRect.origin.x = self.textContainerInset.left + layoutFragmentFrame.minX
if #unavailable(iOS 17.0) {

caretRect.origin.x += self.textContainer.lineFragmentPadding
}
}
}
else if let placeholderLayoutManager {
Expand Down

0 comments on commit 595eecf

Please sign in to comment.