Skip to content

Commit f1af194

Browse files
BridgeARrefack
authored andcommitted
Revert "lib: repl multiline history support"
This reverts commit dd7a3d2. PR-URL: nodejs#24804 Refs: nodejs#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 1e656f5 commit f1af194

File tree

3 files changed

+0
-34
lines changed

3 files changed

+0
-34
lines changed

lib/readline.js

-25
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,6 @@ function Interface(input, output, completer, terminal) {
225225

226226
// Current line
227227
this.line = '';
228-
this.multiline = '';
229228

230229
this._setRawMode(true);
231230
this.terminal = true;
@@ -337,7 +336,6 @@ Interface.prototype._addHistory = function() {
337336
if (dupIndex !== -1) this.history.splice(dupIndex, 1);
338337
}
339338

340-
this.multiline += this.line;
341339
this.history.unshift(this.line);
342340

343341
// Only store so many
@@ -348,29 +346,6 @@ Interface.prototype._addHistory = function() {
348346
return this.history[0];
349347
};
350348

351-
// Called when a multiline is seen by the repl
352-
Interface.prototype.undoHistory = function() {
353-
if (this.terminal) {
354-
this.history.shift();
355-
}
356-
};
357-
358-
// If it's a multiline code, then add history
359-
// accordingly.
360-
Interface.prototype.multilineHistory = function() {
361-
// check if we got a multiline code
362-
if (this.multiline !== '' && this.terminal) {
363-
const dupIndex = this.history.indexOf(this.multiline);
364-
if (dupIndex !== -1) this.history.splice(dupIndex, 1);
365-
// Remove the last entered line as multiline
366-
// already contains them.
367-
this.history.shift();
368-
this.history.unshift(this.multiline);
369-
}
370-
371-
// clear the multiline buffer
372-
this.multiline = '';
373-
};
374349

375350
Interface.prototype._refreshLine = function() {
376351
// line length

lib/repl.js

-2
Original file line numberDiff line numberDiff line change
@@ -774,7 +774,6 @@ exports.start = function(prompt,
774774

775775
REPLServer.prototype.clearBufferedCommand = function clearBufferedCommand() {
776776
this[kBufferedCommandSymbol] = '';
777-
REPLServer.super_.prototype.multilineHistory.call(this);
778777
};
779778

780779
REPLServer.prototype.close = function close() {
@@ -889,7 +888,6 @@ REPLServer.prototype.displayPrompt = function(preserveCursor) {
889888
const len = this.lines.level.length ? this.lines.level.length - 1 : 0;
890889
const levelInd = '..'.repeat(len);
891890
prompt += levelInd + ' ';
892-
Interface.prototype.undoHistory.call(this);
893891
}
894892

895893
// Do not overwrite `_initialPrompt` here

test/parallel/test-repl-persistent-history.js

-7
Original file line numberDiff line numberDiff line change
@@ -111,13 +111,6 @@ const tests = [
111111
test: [UP],
112112
expected: [prompt, replFailedRead, prompt, replDisabled, prompt]
113113
},
114-
{ // Tests multiline history
115-
env: {},
116-
test: ['{', '}', UP, CLEAR],
117-
expected: [prompt, '{', '... ', '}', '{}\n',
118-
prompt, `${prompt}{}`, prompt],
119-
clean: false
120-
},
121114
{
122115
before: function before() {
123116
if (common.isWindows) {

0 commit comments

Comments
 (0)