Skip to content

Commit

Permalink
repl: remove lastInputPreview conditional check
Browse files Browse the repository at this point in the history
PR-URL: #46857
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Kohei Ueno <kohei.ueno119@gmail.com>
  • Loading branch information
jenthone authored and danielleadams committed Apr 11, 2023
1 parent 09739a2 commit 34ba230
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
7 changes: 2 additions & 5 deletions lib/internal/repl/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,6 @@ function setupPreview(repl, contextSymbol, bufferSymbol, active) {
}

let inputPreview = null;
let lastInputPreview = '';

let previewCompletionCounter = 0;
let completionPreview = null;
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
}

Expand Down
3 changes: 1 addition & 2 deletions test/parallel/test-repl-reverse-search.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit 34ba230

Please sign in to comment.