repl: remove preview when press escape
Fix: https://github.com/nodejs/node/issues/42040
This change makes the preview part disappear when pressing ESCAPE
.
According to https://github.com/nodejs/node/commit/80913e655fef0950be61b5fb97261956f9d2c5bb, when pressing ESCAPE
before ENTER
, the preview part will not be included.
without ESCAPE
:
> var add = x => y => x+y
var add = x => y => x+yield <- ENTER
with ESCAPE
:
> var add = x => y => x+y
> var add = x => y => x+y <- ESCAPE
var add = x => y => x+y <- ENTER
but it's confusing that the preview part is not removed after pressing ESCAPE
, this change makes it more intuitive.