From 803d91c0512aad96138a990ed3645d414424df34 Mon Sep 17 00:00:00 2001 From: Ryan ZHAO <> Date: Tue, 27 Aug 2024 09:16:37 +1000 Subject: [PATCH] fix an issue on styling the localized strings --- SessionUIKit/Utilities/Localization+Style.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SessionUIKit/Utilities/Localization+Style.swift b/SessionUIKit/Utilities/Localization+Style.swift index 024e5e9c4..8919026b6 100644 --- a/SessionUIKit/Utilities/Localization+Style.swift +++ b/SessionUIKit/Utilities/Localization+Style.swift @@ -12,7 +12,7 @@ public extension NSAttributedString { /// /// **Note:** The `{1,X}` defines a minimum and maximum tag length and may need to be updated if we add support /// for longer tags that are currently supported - static let regexPattern: String = #"<(?\/)?(?[A-Za-z0-9]{1,1})>"# + static let regexPattern: String = #"<(?\/)?(?[A-Za-z0-9]{1,})>"# case bold = "b" case italic = "i" @@ -87,7 +87,7 @@ public extension NSAttributedString { let currentMatchEnd: Int = currentMatch.range.upperBound /// Ignore invalid ranges - guard (currentMatchStart > lastMatchEnd) || (currentMatchStart == lastMatchEnd && currentMatchStart == 0) else { return } + guard (currentMatchStart >= lastMatchEnd) else { return } /// Retrieve the tag and content values, store the content and any tags which are currently applied so we can construct the /// formatted string at the end