Fix issue 442 - Only use the actual mention match

This commit is contained in:
Ulrich K 2022-11-12 15:50:20 +01:00
parent a10b404677
commit 8e5685aad2

View file

@ -718,7 +718,7 @@ public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
* @return {@link TextWatcher}
*/
public TextWatcher initializeTextWatcher(ComposeAdapter.ComposeViewHolder holder) {
String pattern = "(.|\\s)*(@[\\w_-]+@[a-z0-9.\\-]+|@[\\w_-]+)";
String pattern = "(.|\\s)*(?<mention>@[\\w_-]+@[a-z0-9.\\-]+|@[\\w_-]+)";
final Pattern mentionPattern = Pattern.compile(pattern);
String patternTag = "^(.|\\s)*(#([\\w-]{2,}))$";
@ -884,7 +884,7 @@ public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
matcherTag = tagPattern.matcher(searchIn);
matcherEmoji = emojiPattern.matcher(searchIn);
if (matcherMention.matches()) {
String searchGroup = matcherMention.group();
String searchGroup = matcherMention.group("mention");
accountsVM.searchAccounts(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, searchGroup, 10, true, false).observe((LifecycleOwner) context, accounts -> {
if (accounts == null) {
return;