From f1b352ff6b76cd0b3181a5315d024c0b32cbf9ae Mon Sep 17 00:00:00 2001 From: Taksh Date: Mon, 5 Oct 2026 16:10:52 +0530 Subject: [PATCH] Recognize combining marks in formatted mentions Split the existing PR change into a smaller reviewable piece. Original change: fix(composer): accept combining marks in @mention regex --- bitchat/Services/MessageFormattingEngine.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bitchat/Services/MessageFormattingEngine.swift b/bitchat/Services/MessageFormattingEngine.swift index 1578f16b..220f83b2 100644 --- a/bitchat/Services/MessageFormattingEngine.swift +++ b/bitchat/Services/MessageFormattingEngine.swift @@ -41,7 +41,9 @@ final class MessageFormattingEngine { enum Patterns { static let hashtag = SafeRegex.compile("#([a-zA-Z0-9_]+)") - static let mention = SafeRegex.compile("@([\\p{L}0-9_]+(?:#[a-fA-F0-9]{4})?)") + // Include \p{M} so NFD nicknames (base letter + combining mark) still + // parse as one mention token; NFC forms are covered by \p{L} alone. + static let mention = SafeRegex.compile("@([\\p{L}\\p{M}0-9_]+(?:#[a-fA-F0-9]{4})?)") /// Trailing partial `@nickname` at the composer cursor — autocomplete only. static let mentionAutocomplete = SafeRegex.compile("@([\\p{L}0-9_]*)$")