AlecAivazis / survey

A golang library for building interactive and accessible prompts with full support for windows and posix terminals.
MIT License
4.09k stars 352 forks source link

With serial port, Ask() prompt print multiple whitespaces for every key input #326

Open atto-js opened 3 years ago

atto-js commented 3 years ago

What operating system and terminal are you using? Ubuntu20.04, connect system with serial port(ttyS0)

An example that showcases the bug. I connected to my linux server through a serial cable from a macbook (minicom), then I ran the example code on github page (Asking what is my name) But every time I input a key, it prints out several whitespace characters.

https://user-images.githubusercontent.com/73513214/103501437-885db880-4e91-11eb-9e4c-1d65d8bf37ad.mov

It is assumed that some escape character output from the render function is not interpreted through a serial port.

Well, in testing section in github pages, it says "Since os.Stdout in a go test process is not a TTY, if you are manipulating the cursor or using survey, you will need a way to interpret terminal / ANSI escape sequences for things like CursorLocation", so I think the problem I experienced seems to be related to this sentence. However, I don't know exactly how to solve it / or avoid this issue.

Is there a way to solve this problem?

Thanks