You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a prompt and the user input fills the terminal width and the input has to go to the next line, the prompt is written again in a new line.
In a small terminal, the proof of concept bellow will cause multiple lines like:
$ go run longprompt.go
✔ Please enter a long very long answer so it has to go to the next line: abcdefg
✔ Please enter a long very long answer so it has to go to the next line: abcdefg
✔ Please enter a long very long answer so it has to go to the next line: abcdefg
hi
Proof of concept:
package main
import (
"fmt""github.com/manifoldco/promptui"
)
funcmain() {
prompt:= promptui.Prompt{
Label: "Please enter a long very long answer so it has to go to the next line",
}
result, err:=prompt.Run()
iferr!=nil {
fmt.Printf("Prompt failed %v\n", err)
return
}
fmt.Printf("You choose %q\n", result)
}
The text was updated successfully, but these errors were encountered:
I am running into the same thing. It looks like for every character that is past the end of the width of the terminal, it prints a new prompt line. In your example, hi were the extra characters, so you got 2 extra lines. I have a much longer string and it's dumping out a ton of lines. (We are expecting users to copy/paste a long string into the terminal)
I ran into this, too. It's being caused by line wrapping in the terminal.
After a little research, there isn't a perfect way to disable this, but I've made the issue better in many (most?) modern terminals by disabling wrapping:
Description
When a prompt and the user input fills the terminal width and the input has to go to the next line, the prompt is written again in a new line.
In a small terminal, the proof of concept bellow will cause multiple lines like:
Proof of concept:
The text was updated successfully, but these errors were encountered: