Skip to content

Commit

Permalink
repl: remove preview when press escape
Browse files Browse the repository at this point in the history
Fix: #42040

PR-URL: #42053
Fixes: #42040
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
Reviewed-By: Mestery <mestery@protonmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
  • Loading branch information
meixg authored and Trott committed Feb 23, 2022
1 parent 19bf6c5 commit dc28d63
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion lib/repl.js
Original file line number Diff line number Diff line change
Expand Up @@ -986,7 +986,9 @@ function REPLServer(prompt,
clearPreview(key);
if (!reverseSearch(d, key)) {
ttyWrite(d, key);
showPreview();
if (key.name !== 'escape') {
showPreview();
}
}
return;
}
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-repl-history-navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ const tests = [
// 10. Word right. Cleanup
'\x1B[0K', '\x1B[3G', '\x1B[7C', ' // n', '\x1B[10G',
// 11. ESCAPE
'\x1B[0K', ' // n', '\x1B[10G', '\x1B[0K',
'\x1B[0K',
// 12. ENTER
'\r\n',
'Uncaught ReferenceError: functio is not defined\n',
Expand Down

0 comments on commit dc28d63

Please sign in to comment.