manifoldco / promptui

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

End key in promt leads infinite print #138

Open sirajyasin opened 4 years ago

sirajyasin commented 4 years ago

Describe the bug: In the user input prompt when i hit end key from keyboard, it prints the string "colorxterm-256" in a infinite loop and the process had to be killed to stop printing to console. This happens only when we have default value set for promptui

Step to reproduce: test file prompt.go

package main
import (
        "fmt"

        "github.com/manifoldco/promptui"
)

func main() {
        prompt := promptui.Prompt{
                Label:    "Username",
                Default:  "Foo",
        }
        result, err := prompt.Run()
        if err != nil {
                fmt.Printf("Prompt failed %v\n", err)
                return
        }
        fmt.Printf("Your username is %q\n", result)
}

go run prompt.go

hit end key when prompted for input

Environment Operating System: Ubuntu 18.04 Kernel version: 4.15.0-88-generic Go version: go1.13.7