diff --git a/mast/timeline.go b/mast/timeline.go index 3d62dab..e8c0291 100644 --- a/mast/timeline.go +++ b/mast/timeline.go @@ -24,6 +24,7 @@ type Timeline struct { Account mastodon.Account Toots []Toot TootIndexStatusIDMappings map[string]int + KnownUsers []string } func NewTimeline(mastodonClient *mastodon.Client) Timeline { @@ -79,6 +80,7 @@ func (timeline *Timeline) Load(timelineType TimelineType) (error) { if exists == false { tootIndex := len(timeline.Toots) timeline.Toots = append(timeline.Toots, NewToot(timeline.client, status, tootIndex)) + timeline.KnownUsers = append(timeline.KnownUsers, status.Account.Acct) // TODO: Deduplicate timeline.TootIndexStatusIDMappings[id] = tootIndex } } diff --git a/tui/tui.go b/tui/tui.go index ce49052..aa442fb 100644 --- a/tui/tui.go +++ b/tui/tui.go @@ -36,7 +36,9 @@ func TUI(tuiCore TUICore, mastodonClient *mastodon.Client) { tuiCore.CmdLine = tview.NewInputField(). SetLabelColor(tcell.ColorDefault). SetFieldBackgroundColor(tcell.ColorDefault). - SetAutocompleteFunc(mast.CmdAutocompleter). + SetAutocompleteFunc(func(input string) ([]string) { + return mast.CmdAutocompleter(input, tuiCore.Timeline.KnownUsers) + }). SetDoneFunc(func(key tcell.Key) { if key == tcell.KeyEnter { cmd := tuiCore.CmdLine.GetText()