ktr0731 / go-fuzzyfinder

fzf-like fuzzy-finder as a Go library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Lockup on second call to `fuzzyfinder.Find()`

zanloy opened this issue · comments

Describe the bug

The window pops up fine for me on the first call to fuzzyfinder.Find() but the program will lock up on the second call. It doesn't even display the second options window. It will just sit at terminal accepting keys and echoing them but nothing except CTRL+C seems to do anything.

To reproduce

The following code will reproduce the error:

package main

import (
        "fmt"
        "github.com/ktr0731/go-fuzzyfinder"
)

func main() {
        first_options := []string{"one", "two", "three"}
        second_options := []string{"uno", "dos", "tres"}

        idx, err := fuzzyfinder.Find(
                first_options,
                func(i int) string { return first_options[i] },
        )

        if err != nil {
                panic(err)
        }

        fmt.Println("First Selection:", first_options[idx])

        idx, err = fuzzyfinder.Find(
                second_options,
                func(i int) string { return second_options[i] },
        )

        if err != nil {
                panic(err)
        }

        fmt.Println("Second Selection:", second_options[idx])
}

Expected behavior

I expect it to give me another window to select an option.

Screenshots

N/A

Environment

  • OS: Linux Mint 20
  • Terminal: zsh 5.8 (x86_64-ubuntu-linux-gnu)
  • go-fuzzyfinder version: v0.3.1

Additional context

ive got the same behavior. github.com/ktr0731/go-fuzzyfinder v0.3.1

commented

This is fixed in v0.3.2.

This resolved it. Thanks for your prompt response.