summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/readline.js6
-rw-r--r--lib/repl.js8
2 files changed, 4 insertions, 10 deletions
diff --git a/lib/readline.js b/lib/readline.js
index e55507416b..8d03cd6e33 100644
--- a/lib/readline.js
+++ b/lib/readline.js
@@ -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
diff --git a/lib/repl.js b/lib/repl.js
index 1ab4031f09..bb5ea3d950 100644
--- a/lib/repl.js
+++ b/lib/repl.js
@@ -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() {