promptui icon indicating copy to clipboard operation
promptui copied to clipboard

select captures previous enter key as input

Open joshuamarquez opened this issue 3 years ago • 0 comments

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

joshuamarquez avatar Jun 16 '21 18:06 joshuamarquez