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.evtKeyPress = make(map[string]func(string, []rune, int) *EventReturn)
rl.TempDirectory = os.TempDir() rl.TempDirectory = os.TempDir()
rl.HistorySearcher = func(filter string) []string { rl.HistorySearcher = func(filter string, suggestions []string) []string {
grps := rl.completeHistory() grp := CompletionGroup{
return grps[0].filterSuggestions(rl) DisplayType: TabDisplayMap,
MaxLength: 10,
Suggestions: suggestions,
}
return grp.filterSuggestions(rl)
} }
// Registers // Registers
rl.initRegisters() rl.initRegisters()