diff options
author | Tulir Asokan <tulir@maunium.net> | 2018-03-20 16:03:05 +0200 |
---|---|---|
committer | Tulir Asokan <tulir@maunium.net> | 2018-03-20 16:03:05 +0200 |
commit | 508b4ea280c60a855ccbc3dff8c27c775aec067a (patch) | |
tree | 6e48cbcfc70373a506cc501dc2caa1ff44860974 /ui/view-main.go | |
parent | bfb5151cb6743fb4b83425360f55ce24c696b7ef (diff) |
Add colon after username completion at beginning of line
Diffstat (limited to 'ui/view-main.go')
-rw-r--r-- | ui/view-main.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/ui/view-main.go b/ui/view-main.go index 2cb8d60..707fd95 100644 --- a/ui/view-main.go +++ b/ui/view-main.go @@ -122,7 +122,12 @@ func (view *MainView) InputTabComplete(text string, cursorOffset int) string { word := findWordToTabComplete(str) userCompletions := roomView.AutocompleteUser(word) if len(userCompletions) == 1 { - text = str[0:len(str)-len(word)] + userCompletions[0] + text[len(str):] + startIndex := len(str)-len(word) + completion := userCompletions[0] + if startIndex == 0 { + completion = completion + ": " + } + text = str[0:startIndex] + completion + text[len(str):] } else if len(userCompletions) > 1 && len(userCompletions) < 6 { roomView.SetStatus(fmt.Sprintf("Completions: %s", strings.Join(userCompletions, ", "))) } |