From 3d78dac65cbab6c6d09eb907c445d8d9dd50bade Mon Sep 17 00:00:00 2001 From: Niels Andriesse Date: Thu, 10 Oct 2019 16:29:58 +1100 Subject: [PATCH] Ensure that mention behavior is consistent cross-platform --- .../securesms/conversation/ConversationActivity.java | 2 +- .../thoughtcrime/securesms/conversation/ConversationItem.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/org/thoughtcrime/securesms/conversation/ConversationActivity.java b/src/org/thoughtcrime/securesms/conversation/ConversationActivity.java index 5da03063cf..9dc5c1320b 100644 --- a/src/org/thoughtcrime/securesms/conversation/ConversationActivity.java +++ b/src/org/thoughtcrime/securesms/conversation/ConversationActivity.java @@ -2756,7 +2756,7 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity List> users = LokiAPI.Companion.getUsers("", threadId, userDatabase); mentionStartIndex = currentEndIndex + 1; userSelectionView.show(users, threadId); - } else if (Character.getType(lastCharacter) != Character.UPPERCASE_LETTER && Character.getType(lastCharacter) != Character.LOWERCASE_LETTER) { + } else if (Character.isWhitespace(lastCharacter)) { mentionStartIndex = -1; userSelectionView.hide(); } else { diff --git a/src/org/thoughtcrime/securesms/conversation/ConversationItem.java b/src/org/thoughtcrime/securesms/conversation/ConversationItem.java index e14e59a7f4..f341aad4f1 100644 --- a/src/org/thoughtcrime/securesms/conversation/ConversationItem.java +++ b/src/org/thoughtcrime/securesms/conversation/ConversationItem.java @@ -777,7 +777,7 @@ public class ConversationItem extends LinearLayout } private SpannableString highlightMentions(CharSequence text, boolean isGroupThread) { - Pattern pattern = Pattern.compile("@\\w*"); + Pattern pattern = Pattern.compile("@[0-9a-fA-F]*"); Matcher matcher = pattern.matcher(text); ArrayList> mentions = new ArrayList<>(); if (matcher.find() && isGroupThread) {