Revert "lib: repl multiline history support"

This reverts commit dd7a3d246d.

PR-URL: https://github.com/nodejs/node/pull/24804
Refs: https://github.com/nodejs/node/issues/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>
This commit is contained in:
Ruben Bridgewater committed 2018-12-07 13:32:49 +01:00
1 parent 6fed6f5e1f
commit 73bc5fd39a
3 files changed
-34

No files matched your search

-25
View File
@@ -225,7 +225,6 @@ function Interface(input, output, completer, terminal) {
// Current line
this.line = '';
this.multiline = '';
this._setRawMode(true);
this.terminal = true;
@@ -336,7 +335,6 @@ Interface.prototype._addHistory = function() {
if (dupIndex !== -1) this.history.splice(dupIndex, 1);
}
this.multiline += this.line;
this.history.unshift(this.line);
// Only store so many
@@ -347,29 +345,6 @@ Interface.prototype._addHistory = function() {
return this.history[0];
};
// Called when a multiline is seen by the repl
Interface.prototype.undoHistory = function() {
if (this.terminal) {
this.history.shift();
}
};
// If it's a multiline code, then add history
// accordingly.
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
// already contains them.
this.history.shift();
this.history.unshift(this.multiline);
}
// clear the multiline buffer
this.multiline = '';
};
Interface.prototype._refreshLine = function() {
// line length
-2
View File
@@ -773,7 +773,6 @@ exports.start = function(prompt,
REPLServer.prototype.clearBufferedCommand = function clearBufferedCommand() {
this[kBufferedCommandSymbol] = '';
REPLServer.super_.prototype.multilineHistory.call(this);
};
REPLServer.prototype.close = function close() {
@@ -888,7 +887,6 @@ REPLServer.prototype.displayPrompt = function(preserveCursor) {
const len = this.lines.level.length ? this.lines.level.length - 1 : 0;
const levelInd = '..'.repeat(len);
prompt += levelInd + ' ';
REPLServer.super_.prototype.undoHistory.call(this);
}
// Do not overwrite `_initialPrompt` here
@@ -111,13 +111,6 @@ const tests = [
test: [UP],
expected: [prompt, replFailedRead, prompt, replDisabled, prompt]
},
{ // Tests multiline history
env: {},
test: ['{', '}', UP, CLEAR],
expected: [prompt, '{', '... ', '}', '{}\n',
prompt, `${prompt}{}`, prompt],
clean: false
},
{
before: function before() {
if (common.isWindows) {