From f8b256c0d4a60cab10544bf440e8ab7044fef0cb Mon Sep 17 00:00:00 2001 From: Jakub Jankiewicz Date: Mon, 23 Dec 2024 13:18:37 +0100 Subject: [PATCH] fix space in front of output in REPL #406 --- CHANGELOG.md | 1 + bin/lips.js | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 078b12c4..779e3859 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ ### Bugfix * fix exception when handling parse error for lonely `)` [#417](https://github.com/jcubic/lips/issues/417) * fix unboxing arguments of LIPS created classes [#411](https://github.com/jcubic/lips/issues/411) +* fix space in front of output in REPL [#406](https://github.com/jcubic/lips/issues/406) ## 1.0.0-beta.20 ### Feature diff --git a/bin/lips.js b/bin/lips.js index 8eef9d71..ed7fbfad 100755 --- a/bin/lips.js +++ b/bin/lips.js @@ -681,7 +681,9 @@ function run_repl(err, rl) { // so we have the change to syntax highlight the command line // this needs to happen on next tick so the string have time // to updated with a given key - rl._refreshLine(); + if (cmd) { + rl._refreshLine(); + } }, 0); }); bootstrap(interp).then(function() { @@ -714,9 +716,9 @@ function run_repl(err, rl) { // https://github.com/nodejs/node/issues/11699 rl.setPrompt(''); rl.pause(); + cmd = ''; prev_eval = prev_eval.then(function() { const result = run(code, interp, dynamic, null, options.t || options.trace, false); - cmd = ''; return result; }).then(function(result) { if (process.stdin.isTTY) {