From 56dbb15e7c029a46743826d4020b9210dc14edde Mon Sep 17 00:00:00 2001 From: Duy Mac Van Date: Wed, 1 Mar 2023 21:28:31 +0700 Subject: [PATCH] repl: remove lastInputPreview conditional check PR-URL: https://github.com/nodejs/node/pull/46857 Reviewed-By: Ruben Bridgewater Reviewed-By: Kohei Ueno --- lib/internal/repl/utils.js | 7 ++----- test/parallel/test-repl-reverse-search.js | 3 +-- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/lib/internal/repl/utils.js b/lib/internal/repl/utils.js index 618b5775414c58..84eddf6e86322d 100644 --- a/lib/internal/repl/utils.js +++ b/lib/internal/repl/utils.js @@ -147,7 +147,6 @@ function setupPreview(repl, contextSymbol, bufferSymbol, active) { } let inputPreview = null; - let lastInputPreview = ''; let previewCompletionCounter = 0; let completionPreview = null; @@ -179,7 +178,6 @@ function setupPreview(repl, contextSymbol, bufferSymbol, active) { moveCursor(repl.output, 0, rows); clearLine(repl.output); moveCursor(repl.output, 0, -rows); - lastInputPreview = inputPreview; inputPreview = null; } if (completionPreview !== null) { @@ -396,9 +394,8 @@ function setupPreview(repl, contextSymbol, bufferSymbol, active) { wrapped = false; - // Ignore the output if the value is identical to the current line and the - // former preview is not identical to this preview. - if (line === inspected && lastInputPreview !== inspected) { + // Ignore the output if the value is identical to the current line. + if (line === inspected) { return; } diff --git a/test/parallel/test-repl-reverse-search.js b/test/parallel/test-repl-reverse-search.js index 2808c953431bd2..d92ac9221936c5 100644 --- a/test/parallel/test-repl-reverse-search.js +++ b/test/parallel/test-repl-reverse-search.js @@ -238,8 +238,7 @@ const tests = [ '2\n', '\x1B[1G', '\x1B[0J', prompt, '\x1B[3G', - '2', '\n// 2', '\x1B[4G', '\x1B[1A', - '\x1B[1B', '\x1B[2K', '\x1B[1A', + '2', '\nbck-i-search: _', '\x1B[1A', '\x1B[4G', '\x1B[3G', '\x1B[0J', 'Array(100).fill(1)\nbck-i-search: r_', '\x1B[1A', '\x1B[5G',