Skip to content

Commit 73bc5fd

Browse files
committed
Revert "lib: repl multiline history support"
This reverts commit dd7a3d2. 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 6fed6f5 commit 73bc5fd

3 files changed

Lines changed: 0 additions & 34 deletions

File tree

‎lib/readline.js‎

Lines changed: 0 additions & 25 deletions
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;
@@ -336,7 +335,6 @@ Interface.prototype._addHistory = function() {
336335
if(dupIndex!==-1)this.history.splice(dupIndex,1);
337336
}
338337

339-
this.multiline+=this.line;
340338
this.history.unshift(this.line);
341339

342340
// Only store so many
@@ -347,29 +345,6 @@ Interface.prototype._addHistory = function() {
347345
returnthis.history[0];
348346
};
349347

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

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

‎lib/repl.js‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -773,7 +773,6 @@ exports.start = function(prompt,
773773

774774
REPLServer.prototype.clearBufferedCommand=functionclearBufferedCommand(){
775775
this[kBufferedCommandSymbol]='';
776-
REPLServer.super_.prototype.multilineHistory.call(this);
777776
};
778777

779778
REPLServer.prototype.close=functionclose(){
@@ -888,7 +887,6 @@ REPLServer.prototype.displayPrompt = function(preserveCursor) {
888887
constlen=this.lines.level.length ? this.lines.level.length-1 : 0;
889888
constlevelInd='..'.repeat(len);
890889
prompt+=levelInd+' ';
891-
REPLServer.super_.prototype.undoHistory.call(this);
892890
}
893891

894892
// Do not overwrite `_initialPrompt` here

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

Lines changed: 0 additions & 7 deletions
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: functionbefore(){
123116
if(common.isWindows){

0 commit comments

Comments
 (0)