Adding trailing space " " or ": " if the user started a sentence by mentioning someone,

This commit is contained in:
ariskotsomitopoulos 2021-10-11 11:46:37 +03:00
parent 3a387c5e32
commit 506dfe5fea
1 changed files with 10 additions and 2 deletions

View File

@ -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(