mirror of
https://github.com/vector-im/element-android.git
synced 2024-11-15 01:35:07 +08:00
Adding trailing space " " or ": " if the user started a sentence by mentioning someone,
This commit is contained in:
parent
3a387c5e32
commit
506dfe5fea
@ -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(
|
||||
|
Loading…
Reference in New Issue
Block a user