Open axelKingsley opened 3 years ago
One deficiency I noticed after using this for a while: If the users input should cause a line-wrap in their terminal, the original problem (reprint on every keystroke) starts back up. I would suspect this means that the printing itself should be reconsidered, but this commit at least improves the situation, if there are no side-effects.
would very much appreciate a merge here!
Commit Message
https://github.com/heapwolf/prompt-sync/issues/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.
Testing
Wrote and executed a simple script that captures multi-line and single-line prompts.
And Executed:
Potential Side-Effects
I looked over the index.js and didn't see anything concerning, but if there's an expectation that the ask variable is the full string provided by the user, that expectation would be broken beyond line 79.