manifoldco / promptui

Interactive prompt for command-line applications
https://www.manifold.co
BSD 3-Clause "New" or "Revised" License
6.03k stars 333 forks source link

Lines are eaten while selecting and outputing at the same time #190

Open BLACK-RAIN-BOW opened 2 years ago

BLACK-RAIN-BOW commented 2 years ago

Here's the code snippet:

prompt := promptui.Select{
    Label: "Select Day",
    Items: []string{"Monday", "Tuesday", "Wednesday", "Thursday", "Friday",
        "Saturday", "Sunday"},
}
go func() {
    i := 0
    for {
        i++
        for j := 1; j <= i*2; j++ {
            fmt.Println(strings.Repeat(strconv.Itoa(i), 40))
        }
        time.Sleep(2 * time.Second)
    }
}()

_, result, err := prompt.Run()

if err != nil {
    fmt.Printf("Prompt failed %v\n", err)
    return
}

fmt.Printf("You choose %q\n", result)

Can you provide some method to force rolling or other methods to fix>?

m0sh1x2 commented 2 years ago

I am experiencing exactly the same issue.

Can you let me know if you found a workaround?