Skip to content

Commit 6fed6f5

Browse files
committed
Revert "repl: handle buffered string logic on finish"
This reverts commit eb42c1e. PR-URL: #24804 Refs: #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>
1 parent c8d5e31 commit 6fed6f5

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
@@ -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

lib/repl.js

+1-7
Original file line numberDiff line numberDiff 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

781774
REPLServer.prototype.clearBufferedCommand = function clearBufferedCommand() {
782775
this[kBufferedCommandSymbol] = '';
776+
REPLServer.super_.prototype.multilineHistory.call(this);
783777
};
784778

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

0 commit comments

Comments
 (0)