fix panic for empty completions

This commit is contained in:
Gokcehan 2016-12-15 16:04:15 +03:00
parent 5f87cb2542
commit 751290ed9b

View File

@ -200,10 +200,6 @@ func compCmd(acc []rune) (matches []string, longestAcc []rune) {
s := string(acc) s := string(acc)
f := tokenize(s) f := tokenize(s)
if len(f) == 0 || s[len(s)-1] == ' ' {
f = append(f, "")
}
var longest string var longest string
switch len(f) { switch len(f) {
@ -243,10 +239,6 @@ func compShell(acc []rune) (matches []string, longestAcc []rune) {
s := string(acc) s := string(acc)
f := strings.Fields(s) f := strings.Fields(s)
if len(f) == 0 || s[len(s)-1] == ' ' {
f = append(f, "")
}
var longest string var longest string
switch len(f) { switch len(f) {