From 8ccd6b0419cc51b272741da6dd27c2781b7bf15d Mon Sep 17 00:00:00 2001 From: Axel Date: Sun, 14 Mar 2021 13:46:16 -0500 Subject: [PATCH] Fix Issue #25: Inappropriate Redrawn Multi-Line Asks 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. --- index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/index.js b/index.js index 076d9f8..7084748 100644 --- a/index.js +++ b/index.js @@ -76,6 +76,7 @@ function create(config) { if (ask) { process.stdout.write(ask); + ask = ask.split(/\r?\n/).pop(); } var cycle = 0;