aboutsummaryrefslogtreecommitdiff
path: root/ui/widget
diff options
context:
space:
mode:
authorTulir Asokan <tulir@maunium.net>2018-03-20 16:03:05 +0200
committerTulir Asokan <tulir@maunium.net>2018-03-20 16:03:05 +0200
commit508b4ea280c60a855ccbc3dff8c27c775aec067a (patch)
tree6e48cbcfc70373a506cc501dc2caa1ff44860974 /ui/widget
parentbfb5151cb6743fb4b83425360f55ce24c696b7ef (diff)
Add colon after username completion at beginning of line
Diffstat (limited to 'ui/widget')
-rw-r--r--ui/widget/room-view.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/ui/widget/room-view.go b/ui/widget/room-view.go
index 1fb19c7..316fcef 100644
--- a/ui/widget/room-view.go
+++ b/ui/widget/room-view.go
@@ -102,8 +102,12 @@ func (view *RoomView) SetTyping(users []string) {
}
func (view *RoomView) AutocompleteUser(existingText string) (completions []string) {
+ textWithoutPrefix := existingText
+ if strings.HasPrefix(existingText, "@") {
+ textWithoutPrefix = existingText[1:]
+ }
for _, user := range view.Room.GetMembers() {
- if strings.HasPrefix(user.DisplayName, existingText) {
+ if strings.HasPrefix(user.DisplayName, textWithoutPrefix) {
completions = append(completions, user.DisplayName)
} else if strings.HasPrefix(user.UserID, existingText) {
completions = append(completions, user.UserID)