From ee20c95a5d4b28ba7825cfe14fb4f696896a373a Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Sun, 16 Aug 2020 14:52:08 -0400 Subject: [PATCH] Prevent link activation when outside character --- Tusker/Views/ContentTextView.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tusker/Views/ContentTextView.swift b/Tusker/Views/ContentTextView.swift index 9a54da00..2e041bd0 100644 --- a/Tusker/Views/ContentTextView.swift +++ b/Tusker/Views/ContentTextView.swift @@ -197,7 +197,7 @@ class ContentTextView: LinkTextView { let locationInTextContainer = CGPoint(x: point.x - textContainerInset.left, y: point.y - textContainerInset.top) var partialFraction: CGFloat = 0 let characterIndex = layoutManager.characterIndex(for: locationInTextContainer, in: textContainer, fractionOfDistanceBetweenInsertionPoints: &partialFraction) - if characterIndex < textStorage.length { + if characterIndex < textStorage.length && partialFraction < 1 { var range = NSRange() if let link = textStorage.attribute(.link, at: characterIndex, longestEffectiveRange: &range, in: textStorage.fullRange) as? URL { return (link, range)