Skip to content

Commit 1e656f5

Browse files
BridgeARrefack
authored andcommitted
Revert "repl: handle buffered string logic on finish"
This reverts commit eb42c1e. PR-URL: nodejs#24804 Refs: nodejs#24231 Reviewed-By: Anto Aravinth <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Jeremiah Senkpiel <[email protected]>
1 parent dd48879 commit 1e656f5

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

lib/readline.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -357,9 +357,9 @@ Interface.prototype.undoHistory = function() {
357357

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

lib/repl.js

+1-7
Original file line numberDiff line numberDiff line change
@@ -666,13 +666,6 @@ function REPLServer(prompt,
666666
}
667667
}
668668

669-
// handle multiline history
670-
if (self[kBufferedCommandSymbol].length)
671-
Interface.prototype.multilineHistory.call(self, false);
672-
else {
673-
Interface.prototype.multilineHistory.call(self, true);
674-
}
675-
676669
// Clear buffer if no SyntaxErrors
677670
self.clearBufferedCommand();
678671
sawCtrlD = false;
@@ -781,6 +774,7 @@ exports.start = function(prompt,
781774

782775
REPLServer.prototype.clearBufferedCommand = function clearBufferedCommand() {
783776
this[kBufferedCommandSymbol] = '';
777+
REPLServer.super_.prototype.multilineHistory.call(this);
784778
};
785779

786780
REPLServer.prototype.close = function close() {

0 commit comments

Comments
 (0)