Skip to content

Commit

Permalink
Fix Issue heapwolf#25: Inappropriate Redrawn Multi-Line Asks
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
axelKingsley committed Mar 14, 2021
1 parent 33a1252 commit 8ccd6b0
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ function create(config) {

if (ask) {
process.stdout.write(ask);
ask = ask.split(/\r?\n/).pop();
}

var cycle = 0;
Expand Down

0 comments on commit 8ccd6b0

Please sign in to comment.