corrected logic error.

This commit is contained in:
Kevin G Christiano 2019-07-25 15:15:32 -04:00
parent 8e6087f86e
commit 7a86febc7c

View File

@ -358,7 +358,7 @@ public typealias ActionBlock = () -> Void
Appends an external link image to the end of the attributed string. Appends an external link image to the end of the attributed string.
Will provide one whitespace to the left of the icon Will provide one whitespace to the left of the icon
*/ */
public func appendExternalLinkIcon() { @objc public func appendExternalLinkIcon() {
guard let attributedText = attributedText else { return } guard let attributedText = attributedText else { return }
@ -386,9 +386,9 @@ public typealias ActionBlock = () -> Void
let mutableString = NSMutableAttributedString(attributedString: attributedText) let mutableString = NSMutableAttributedString(attributedString: attributedText)
if index != 0 { if index != 0 {
mutableString.insert(NSAttributedString(string: " "), at: index - 1) mutableString.insert(NSAttributedString(string: " "), at: index)
} }
mutableString.insert(NSAttributedString(attachment: Label.getTextAttachmentImage(dimension: font.pointSize)), at: index) mutableString.insert(NSAttributedString(attachment: Label.getTextAttachmentImage(dimension: font.pointSize)), at: index + 1)
self.attributedText = mutableString self.attributedText = mutableString
hasAttachmentImage = true hasAttachmentImage = true