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

If a prompt spans multiple lines, keystrokes result in the prompt label being displayed multiple times #143

Closed bcongdon closed 4 years ago

bcongdon commented 4 years ago

Bug description: If the label of a prompt exceeds the horizontal width of the terminal window, then each keystroke results in the prompt being displayed on a newline.

Expected behavior: If a label spans multiple lines, the behavior is identical to if the label spans one line -- the label is displayed only once.

Observed behavior: When a label spans multiple lines, each keystroke results in a new printed version of the label, i.e. https://asciinema.org/a/hHDOBInyBFwBPXN2ZfaPcULKP


Minimal working example:

package main

import (
        "strings"

        "github.com/manifoldco/promptui"
)

func main() {
        prompt := promptui.Prompt{
                Label:     strings.Repeat("Foo", 100),
        }
        prompt.Run()
}

Asciinema recording of the above: https://asciinema.org/a/hHDOBInyBFwBPXN2ZfaPcULKP

bcongdon commented 4 years ago

Duplicate of #122