From 801c20028fc8e53c4348f5d66eeb991a1e9e91f1 Mon Sep 17 00:00:00 2001 From: Dan Abramov Date: Sun, 18 Sep 2016 11:21:22 +0300 Subject: [PATCH] Tweak scroll sequences --- scripts/start.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/scripts/start.js b/scripts/start.js index 84d1e7c4b48..c285dc50e32 100644 --- a/scripts/start.js +++ b/scripts/start.js @@ -69,10 +69,12 @@ function formatMessage(message) { .replace('./~/css-loader!./~/postcss-loader!', ''); } +var isFirstClear = true; function clearConsole() { - // This seems to work best on Windows and other systems. - // The intention is to clear the output so you can focus on most recent build. - process.stdout.write('\x1bc'); + // On first run, clear completely so it doesn't show half screen on Windows. + // On next runs, use a different sequence that properly scrolls back. + process.stdout.write(isFirstClear ? '\x1bc' : '\x1b[2J\x1b[0f'); + isFirstClear = false; } function setupCompiler(port, protocol) {