Revert "repl: handle buffered string logic on finish"

This reverts commit eb42c1eb4f2502433a22c49ede9e657fb6cd86e0.

PR-URL: https://github.com/nodejs/node/pull/24804
Refs: https://github.com/nodejs/node/issues/24231
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
This commit is contained in:
Ruben Bridgewater 2018-12-03 13:08:14 +01:00 committed by Rich Trott
parent aa943d098e
commit fd2467aeaa
2 changed files with 4 additions and 10 deletions

View File

@ -357,9 +357,9 @@ Interface.prototype.undoHistory = function() {
// If it's a multiline code, then add history
// accordingly.
Interface.prototype.multilineHistory = function(clearBuffer) {
// if not clear buffer, add multiline history
if (!clearBuffer && this.terminal) {
Interface.prototype.multilineHistory = function() {
// check if we got a multiline code
if (this.multiline !== '' && this.terminal) {
const dupIndex = this.history.indexOf(this.multiline);
if (dupIndex !== -1) this.history.splice(dupIndex, 1);
// Remove the last entered line as multiline

View File

@ -666,13 +666,6 @@ function REPLServer(prompt,
}
}
// handle multiline history
if (self[kBufferedCommandSymbol].length)
Interface.prototype.multilineHistory.call(self, false);
else {
Interface.prototype.multilineHistory.call(self, true);
}
// Clear buffer if no SyntaxErrors
self.clearBufferedCommand();
sawCtrlD = false;
@ -781,6 +774,7 @@ exports.start = function(prompt,
REPLServer.prototype.clearBufferedCommand = function clearBufferedCommand() {
this[kBufferedCommandSymbol] = '';
REPLServer.super_.prototype.multilineHistory.call(this);
};
REPLServer.prototype.close = function close() {