aboutsummaryrefslogtreecommitdiff
path: root/ui/view-main.go
diff options
context:
space:
mode:
authorTulir Asokan <tulir@maunium.net>2018-04-18 13:38:33 +0300
committerTulir Asokan <tulir@maunium.net>2018-04-18 13:38:33 +0300
commit3750d5007fe31b1a4d706357f43774d08944213e (patch)
treee3a41935dca8c2f7c3d8967d9f58979ecf29ea2b /ui/view-main.go
parent127c89629149e223b5a0c625c935941d513f857e (diff)
Create pills when tab-completing or clicking nicks
Diffstat (limited to 'ui/view-main.go')
-rw-r--r--ui/view-main.go11
1 files changed, 8 insertions, 3 deletions
diff --git a/ui/view-main.go b/ui/view-main.go
index d4ffd39..018fb1a 100644
--- a/ui/view-main.go
+++ b/ui/view-main.go
@@ -104,17 +104,22 @@ func findWordToTabComplete(text string) string {
func (view *MainView) InputTabComplete(roomView *RoomView, text string, cursorOffset int) string {
str := runewidth.Truncate(text, cursorOffset, "")
word := findWordToTabComplete(str)
+
userCompletions := roomView.AutocompleteUser(word)
if len(userCompletions) == 1 {
startIndex := len(str) - len(word)
- completion := userCompletions[0]
+ member := userCompletions[0]
+ completion := fmt.Sprintf("[%s](https://matrix.to/#/%s)", member.DisplayName, member.UserID)
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, ", ")))
+ } else if len(userCompletions) > 1 && len(userCompletions) <= 5 {
+ // roomView.SetStatus(fmt.Sprintf("Completions: %s", strings.Join(userCompletions, ", ")))
+ } else if len(userCompletions) > 5 {
+ roomView.SetStatus("Over 5 completion options.")
}
+
return text
}