fix panic for empty completions
This commit is contained in:
parent
5f87cb2542
commit
751290ed9b
8
comp.go
8
comp.go
@ -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) {
|
||||||
|
Loading…
Reference in New Issue
Block a user