From bbd7d826200db0d8da059970e3d6c630e4093a11 Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Thu, 7 May 2020 21:46:59 -0400 Subject: [PATCH] Fix test in ContentTextView not being de-selectable --- Tusker/Views/ContentTextView.swift | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Tusker/Views/ContentTextView.swift b/Tusker/Views/ContentTextView.swift index 8e81933c..f313c1ce 100644 --- a/Tusker/Views/ContentTextView.swift +++ b/Tusker/Views/ContentTextView.swift @@ -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)