edit/completion: prev and next does nothing when there is no candidate.

This fixes #717.
This commit is contained in:
Qi Xiao 2018-07-14 17:35:44 +01:00
parent b24e4a73cc
commit 43e0761ec7

View File

@ -181,6 +181,9 @@ func (c *completion) apply(line string, dot int) (string, int) {
}
func (c *completion) prev(cycle bool) {
if c.selected == -1 {
return
}
c.selected--
if c.selected == -1 {
if cycle {
@ -192,6 +195,9 @@ func (c *completion) prev(cycle bool) {
}
func (c *completion) next(cycle bool) {
if c.selected == -1 {
return
}
c.selected++
if c.selected == len(c.filtered) {
if cycle {