Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

repl: remove lastInputPreview conditional check #46857

Merged
merged 1 commit into from
Mar 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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