INNER CODE UNIT · Go
completeFromSlice
asciimoo/wuzz · wuzz.go:410
func completeFromSlice(str string, completions []string) []string {
completed := []string{}
if str == "" || strings.TrimRight(str, " \n") != str {
return completed
}
for _, completion := range completions {
if strings.HasPrefix(completion, str) && str != completion {
completed = append(completed, completion)
}
}
return completed
}
func (e *AutocompleteEditor) Edit(v *gocui.View, key gocui.Key, ch rune, mod gocui.Modifier) {
if key != gocui.KeyEnter {
e.wuzzEditor.Edit(v, key, ch, mod)
}