Skip to content

Commit

Permalink
Revert "repl: handle buffered string logic on finish"
Browse files Browse the repository at this point in the history
This reverts commit eb42c1e.

PR-URL: nodejs#24804
Refs: nodejs#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>
  • Loading branch information
BridgeAR authored and refack committed Jan 10, 2019
1 parent dd48879 commit 1e656f5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
6 changes: 3 additions & 3 deletions lib/readline.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 1 addition & 7 deletions lib/repl.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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() {
Expand Down

0 comments on commit 1e656f5

Please sign in to comment.