From 506dfe5fea8dbe6d2e84b365388c7a7e26d43b77 Mon Sep 17 00:00:00 2001 From: ariskotsomitopoulos Date: Mon, 11 Oct 2021 11:46:37 +0300 Subject: [PATCH 1/3] Adding trailing space " " or ": " if the user started a sentence by mentioning someone, --- .../app/features/home/room/detail/AutoCompleter.kt | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/AutoCompleter.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/AutoCompleter.kt index d4430730d7..1fcac59b00 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/AutoCompleter.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/AutoCompleter.kt @@ -220,8 +220,16 @@ class AutoCompleter @AssistedInject constructor( // Replace the word by its completion val displayName = matrixItem.getBestName() - // with a trailing space - editable.replace(startIndex, endIndex, "$displayName ") + + // Adding trailing space " " or ": " if the user started mention someone + val displayNameSuffix = + if (firstChar == "@" && editText.length() == 1) { + ": " + } else { + " " + } + + editable.replace(startIndex, endIndex, "$displayName$displayNameSuffix") // Add the span val span = PillImageSpan( From 3a6259fd299285b5ebb75bcd07f47285b5c5d86c Mon Sep 17 00:00:00 2001 From: ariskotsomitopoulos Date: Mon, 11 Oct 2021 11:53:43 +0300 Subject: [PATCH 2/3] Add changelog file --- changelog.d/908.bugfix | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/908.bugfix diff --git a/changelog.d/908.bugfix b/changelog.d/908.bugfix new file mode 100644 index 0000000000..f43b03e892 --- /dev/null +++ b/changelog.d/908.bugfix @@ -0,0 +1 @@ +Issue #908 Adding trailing space " " or ": " if the user started a sentence by mentioning someone, From a2c790b4a168433f62ee77aa4a9c60cd8f314b74 Mon Sep 17 00:00:00 2001 From: ariskotsomitopoulos Date: Mon, 11 Oct 2021 12:29:00 +0300 Subject: [PATCH 3/3] Update to support the whole typing name --- .../im/vector/app/features/home/room/detail/AutoCompleter.kt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/AutoCompleter.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/AutoCompleter.kt index 1fcac59b00..1d6530218d 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/AutoCompleter.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/AutoCompleter.kt @@ -220,10 +220,9 @@ class AutoCompleter @AssistedInject constructor( // Replace the word by its completion val displayName = matrixItem.getBestName() - // Adding trailing space " " or ": " if the user started mention someone val displayNameSuffix = - if (firstChar == "@" && editText.length() == 1) { + if (firstChar == "@" && startIndex == 0) { ": " } else { " "