summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuben Bridgewater <ruben@bridgewater.de>2018-12-03 13:10:15 +0100
committerRich Trott <rtrott@gmail.com>2018-12-05 23:36:10 -0800
commitb1ada6c9def47a8ca90b0ea79419d3a704d1aa80 (patch)
tree7c79cac41b4495d2a2babb3577f877d79d1285d3
parentfd2467aeaab584f93d2fd78b7d54cc737904e84b (diff)
downloadnode-new-b1ada6c9def47a8ca90b0ea79419d3a704d1aa80.tar.gz
Revert "lib: repl multiline history support"
This reverts commit dd7a3d246ded89cd0c910231c9adec279e72f9a9. 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>
-rw-r--r--lib/readline.js25
-rw-r--r--lib/repl.js2
-rw-r--r--test/parallel/test-repl-persistent-history.js7
3 files changed, 0 insertions, 34 deletions
diff --git a/lib/readline.js b/lib/readline.js
index 8d03cd6e33..5d47c51b99 100644
--- a/lib/readline.js
+++ b/lib/readline.js
@@ -225,7 +225,6 @@ function Interface(input, output, completer, terminal) {
// Current line
this.line = '';
- this.multiline = '';
this._setRawMode(true);
this.terminal = true;
@@ -337,7 +336,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
@@ -348,29 +346,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
diff --git a/lib/repl.js b/lib/repl.js
index bb5ea3d950..dd675fc435 100644
--- a/lib/repl.js
+++ b/lib/repl.js
@@ -774,7 +774,6 @@ exports.start = function(prompt,
REPLServer.prototype.clearBufferedCommand = function clearBufferedCommand() {
this[kBufferedCommandSymbol] = '';
- REPLServer.super_.prototype.multilineHistory.call(this);
};
REPLServer.prototype.close = function close() {
@@ -889,7 +888,6 @@ REPLServer.prototype.displayPrompt = function(preserveCursor) {
const len = this.lines.level.length ? this.lines.level.length - 1 : 0;
const levelInd = '..'.repeat(len);
prompt += levelInd + ' ';
- Interface.prototype.undoHistory.call(this);
}
// Do not overwrite `_initialPrompt` here
diff --git a/test/parallel/test-repl-persistent-history.js b/test/parallel/test-repl-persistent-history.js
index 32bab3c8ed..bb10085ecc 100644
--- a/test/parallel/test-repl-persistent-history.js
+++ b/test/parallel/test-repl-persistent-history.js
@@ -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) {