go-fzf
go-fzf copied to clipboard
Multi select input does not work after single select
Running fzf with WithNoLimit(false) and then with WithNoLimit(true) breaks toggling, that is, the program no longer responds to TAB key. Running fzf twice with WithNoLimit(true) does not break toggle input.
package main
import (
"github.com/koki-develop/go-fzf"
)
func main() {
items := []string{"a", "b", "c"}
{
ff, err := fzf.New(fzf.WithNoLimit(false)) // <<<
if err != nil {
panic(err)
}
_, err = ff.Find(items, func(i int) string { return items[i] })
if err != nil {
panic(err)
}
}
{
ff, err := fzf.New(fzf.WithNoLimit(true)) // <<<
if err != nil {
panic(err)
}
_, err = ff.Find(items, func(i int) string { return items[i] })
if err != nil {
panic(err)
}
}
}
Passing fzf.KeyMap to the second invocation fixes input.
ff, err := fzf.New(
fzf.WithNoLimit(true),
fzf.WithKeyMap(fzf.KeyMap{
Toggle: []string{"tab", "left", "right"},
}),
)