diff --git a/feature-chats/src/main/java/com/anytypeio/anytype/feature_chats/presentation/ChatViewModel.kt b/feature-chats/src/main/java/com/anytypeio/anytype/feature_chats/presentation/ChatViewModel.kt
index cfc65867de..3acbfc654d 100644
--- a/feature-chats/src/main/java/com/anytypeio/anytype/feature_chats/presentation/ChatViewModel.kt
+++ b/feature-chats/src/main/java/com/anytypeio/anytype/feature_chats/presentation/ChatViewModel.kt
@@ -381,6 +381,7 @@ class ChatViewModel @Inject constructor(
selection: IntRange,
text: String
) {
+ Timber.d("DROID-2966 onChatBoxInputChanged")
val query = resolveMentionQuery(
text = text,
selectionStart = selection.start
@@ -393,7 +394,7 @@ class ChatViewModel @Inject constructor(
query = query
)
} else {
- Timber.w("Query is empty or results are empty when mention is triggered")
+ Timber.w("DROID-2966 Query is empty or results are empty when mention is triggered")
}
} else if (shouldHideMention(text, selection.start)) {
mentionPanelState.value = MentionPanelState.Hidden
@@ -1045,10 +1046,15 @@ class ChatViewModel @Inject constructor(
private fun resolveMentionQuery(text: String, selectionStart: Int): MentionPanelState.Query? {
val atIndex = text.lastIndexOf('@', selectionStart - 1)
- if (atIndex == -1 || (atIndex > 0 && text[atIndex - 1].isLetterOrDigit())) return null
- val endIndex = text.indexOf(' ', atIndex).takeIf { it != -1 } ?: text.length
+ if (atIndex == -1) return null
+
+ val beforeAt = text.getOrNull(atIndex - 1)
+ if (beforeAt != null && beforeAt.isLetterOrDigit()) return null
+
+ val endIndex = text.indexOfAny(charArrayOf(' ', '\n'), startIndex = atIndex)
+ .takeIf { it != -1 } ?: text.length
+
val query = text.substring(atIndex + 1, endIndex)
- // Allow empty queries if there's no space after '@'
return MentionPanelState.Query(query, atIndex until endIndex)
}
diff --git a/feature-chats/src/main/java/com/anytypeio/anytype/feature_chats/ui/ChatBubble.kt b/feature-chats/src/main/java/com/anytypeio/anytype/feature_chats/ui/ChatBubble.kt
index 6c50eda993..2672514a30 100644
--- a/feature-chats/src/main/java/com/anytypeio/anytype/feature_chats/ui/ChatBubble.kt
+++ b/feature-chats/src/main/java/com/anytypeio/anytype/feature_chats/ui/ChatBubble.kt
@@ -339,7 +339,7 @@ fun Bubble(
DropdownMenuItem(
text = {
Text(
- text = stringResource(R.string.copy_text),
+ text = stringResource(R.string.copy_plain_text),
color = colorResource(id = R.color.text_primary),
modifier = Modifier.padding(end = 64.dp)
)
diff --git a/localization/src/main/res/values/strings.xml b/localization/src/main/res/values/strings.xml
index 3efe1f971e..0d0118c3a9 100644
--- a/localization/src/main/res/values/strings.xml
+++ b/localization/src/main/res/values/strings.xml
@@ -1859,6 +1859,7 @@ Please provide specific details of your needs here.
Chat
Copy
Copy Text
+ Copy Plain Text
Edit message
edited
There is no messages yet.\nBe the first to start a discussion.