perf(readline): make completion group with passed suggestions instead of looping over history twice

history-searcher
TorchedSammy 2022-07-17 18:25:19 -04:00
parent 3dae826578
commit 7434d270e4
Signed by: sammyette
GPG Key ID: 904FC49417B44DCD
1 changed files with 7 additions and 3 deletions

View File

@ -231,9 +231,13 @@ func NewInstance() *Instance {
rl.evtKeyPress = make(map[string]func(string, []rune, int) *EventReturn)
rl.TempDirectory = os.TempDir()
rl.HistorySearcher = func(filter string) []string {
grps := rl.completeHistory()
return grps[0].filterSuggestions(rl)
rl.HistorySearcher = func(filter string, suggestions []string) []string {
grp := CompletionGroup{
DisplayType: TabDisplayMap,
MaxLength: 10,
Suggestions: suggestions,
}
return grp.filterSuggestions(rl)
}
// Registers
rl.initRegisters()