Merge pull request #4210 from vector-im/feature/aris/issue_908_user_completion_picket

Feature/aris/issue 908 user completion picket
This commit is contained in:
Benoit Marty 2021-10-11 12:31:30 +02:00 committed by GitHub
commit 737a290841
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 2 deletions

1
changelog.d/908.bugfix Normal file
View file

@ -0,0 +1 @@
Issue #908 Adding trailing space " " or ": " if the user started a sentence by mentioning someone,

View file

@ -220,8 +220,15 @@ 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 == "@" && startIndex == 0) {
": "
} else {
" "
}
editable.replace(startIndex, endIndex, "$displayName$displayNameSuffix")
// Add the span
val span = PillImageSpan(