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

Label get repeated on a keyboard stroke #122

Open GunnlaugurCalvi opened 4 years ago

GunnlaugurCalvi commented 4 years ago

If Label is a pretty long string then on every keyboard stroke the text get repeated issueprmpui

chriszzt commented 4 years ago

It is due to the function Write() in Screenbuf.go assumes input to be only one line. So if your input in the terminal has more than one line, it only rewrites the previous one line. I have my own hack of screenbuf that calculates the height on my own. The reason being hack is some special characters in prompt make us hard to get actual prompt length. (the actual length might be smaller, showing in your terminal)

You could try my fork. I fixed it in some way. Since it is a bit hacky, I won't create pr for now. https://github.com/tigergraph/promptui

TylerGillson commented 1 year ago

See https://github.com/manifoldco/promptui/issues/92 for another alternate solution