-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prompt repeats itself on each keypress with multi-line template literals. #25
Comments
+1 |
👍 PR welcome |
On Node v12.14.1 , this is happening for me for all multi-line strings, even without template literals. |
One easy workaround for this -- print your multi-line prompt using |
Why was this issue closed when it's still a problem as sorousjp reported? Why has a serious bug like this been left unfixed for 6 months? Should I look for a replacement package that's maintained? |
This is still an issue. |
It was really hard to find this issue since I didn't know why my prompts were being repeated, so I wonder if there are more folks having this issue who haven't realized it's due to multi-line literals. Taking @soroushjp suggestion, I've put together this script which helps demonstrate the problem, and solves the prompt issue by wrapping up the console logging and prompting automatically:
|
heapwolf#25 Prompts were causing bad user experience in situations where the prompt contains multiple lines. This is because prompt-sync will redraw the prompt as you type, and assumes it only takes up one line. The fix provided splits the provided ask by newline, prints all but the last line only once, and assigns the final line to the ask variable used for the remainder of the module.
heapwolf#25 Prompts were causing bad user experience in situations where the prompt contains multiple lines. This is because prompt-sync will redraw the prompt as you type, and assumes it only takes up one line. The fix provided splits the provided ask by newline, prints all but the last line only once, and assigns the final line to the ask variable used for the remainder of the module.
heapwolf#25 Prompts were causing bad user experience in situations where the prompt contains multiple lines. This is because prompt-sync will redraw the prompt as you type, and assumes it only takes up one line. The fix provided prints the whole ask string, before reassigning ask to be only the final line of the prompt. This way, redraws don't affect above lines.
Whoops, sorry for the notification spam on this issue, I was polishing the PR commit in my fork. My PR Should solve this issue. It just sets Thanks for this module, Paolo! Let me know if there's something I missed with regards to the fix. |
This repo seems to be inactive at this time. I wrote a modern port of it called prompt-sync-plus intended to be mostly a drop-in replacement for this (with some exceptions); multi-line prompts, and multi-line input in general was one of the issues addressed. |
Used prompt with a multi-line template literal, and the stdout would repeat itself on a newline with each keypress. User input worked fine though.
The problem was fixed by going to es5 syntax.
The text was updated successfully, but these errors were encountered: