File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -356,9 +356,9 @@ Interface.prototype.undoHistory = function() {
356356
357357// If it's a multiline code, then add history
358358// accordingly.
359- Interface.prototype.multilineHistory = function(clearBuffer ) {
360- // if not clear buffer, add multiline history
361- if (!clearBuffer && this.terminal) {
359+ Interface.prototype.multilineHistory = function() {
360+ // check if we got a multiline code
361+ if (this.multiline !== '' && this.terminal) {
362362 const dupIndex = this.history.indexOf(this.multiline);
363363 if (dupIndex !== -1) this.history.splice(dupIndex, 1);
364364 // Remove the last entered line as multiline
Original file line number Diff line number Diff line change @@ -667,13 +667,6 @@ function REPLServer(prompt,
667667 }
668668 }
669669
670- // handle multiline history
671- if (self[kBufferedCommandSymbol].length)
672- REPLServer.super_.prototype.multilineHistory.call(self, false);
673- else {
674- REPLServer.super_.prototype.multilineHistory.call(self, true);
675- }
676-
677670 // Clear buffer if no SyntaxErrors
678671 self.clearBufferedCommand();
679672 sawCtrlD = false;
@@ -780,6 +773,7 @@ exports.start = function(prompt,
780773
781774REPLServer.prototype.clearBufferedCommand = function clearBufferedCommand() {
782775 this[kBufferedCommandSymbol] = '';
776+ REPLServer.super_.prototype.multilineHistory.call(this);
783777};
784778
785779REPLServer.prototype.close = function close() {
You can’t perform that action at this time.
0 commit comments