From 8b0d208047f66d01eba28c4a04244876c52c126c Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Mon, 2 Dec 2019 15:59:44 -0500 Subject: [PATCH] Current solution to widow word. --- MVMCoreUI/Atoms/Views/Label.swift | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/MVMCoreUI/Atoms/Views/Label.swift b/MVMCoreUI/Atoms/Views/Label.swift index 8474d74a..d677cf4b 100644 --- a/MVMCoreUI/Atoms/Views/Label.swift +++ b/MVMCoreUI/Atoms/Views/Label.swift @@ -685,13 +685,20 @@ extension Label { /// Converts the entire text into a link. All characters will be underlined and the intrinsic bounds will respond to tap. @objc public func makeTextButton(actionBlock: @escaping ActionBlock) { - + setTextLinkState(range: getRange, actionBlock: actionBlock) } /// Underlines the tappable region and stores the tap logic for interation. private func setTextLinkState(range: NSRange, actionBlock: @escaping ActionBlock) { + if clauses.isEmpty { + // Replace the last whitespace with \u{00A0} No-break space. + if let start = text?.lastIndex(of: " "), let end = text?.index(after: start) { + text?.replaceSubrange(start..