Fix test in ContentTextView not being de-selectable

This commit is contained in:
Shadowfacts 2020-05-07 21:46:59 -04:00
parent 02088b1f55
commit bbd7d82620
Signed by untrusted user: shadowfacts
GPG Key ID: 94A5AB95422746E5
1 changed files with 6 additions and 1 deletions

View File

@ -171,8 +171,13 @@ class ContentTextView: LinkTextView {
}
}
// only handles link taps via the gesture recognizer which is used when selection is disabled
@objc func textTapped(_ recognizer: UITapGestureRecognizer) {
// if there currently is a selection, deselct it on single-tap
if selectedRange.length > 0 {
// location doesn't matter since we are non-editable and the cursor isn't visible
selectedRange = NSRange(location: 0, length: 0)
}
let location = recognizer.location(in: self)
if let (link, range) = getLinkAtPoint(location) {
let text = (self.text as NSString).substring(with: range)