promptui
promptui copied to clipboard
select captures previous enter key as input
before select is executed, if enter key is pressed this one will be captured as input for select misleading to undesired behavior.
code to reproduce
package main
import (
"fmt"
"time"
"github.com/manifoldco/promptui"
)
func main() {
fmt.Println("press 'enter key' to reproduce behaviour")
time.Sleep(5000 * time.Millisecond)
prompt := promptui.Select{
Label: "Select Day",
Items: []string{"Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"},
}
_, result, err := prompt.Run()
if err != nil {
fmt.Printf("Prompt failed %v\n", err)
return
}
fmt.Printf("You choose %q\n", result)
}
![Screen Shot 2021-06-16 at 11 36 09](https://user-images.githubusercontent.com/12701027/122274136-13a69580-ce97-11eb-9774-b848d8d9cfd6.png)