GeezerVison is showing github.com — Revert "lib: repl multiline history support" · nodejs/node@73bc5fd
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: lib/readline.js -25Lines changed: 0 additions & 25 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -225,7 +225,6 @@ function Interface(input, output, completer, terminal) { | 225 | 225 |
| 226 | 226 | // Current line | 227 | 227 | this.line = ''; | 228 | | - this.multiline = ''; | 229 | 228 |
| 230 | 229 | this._setRawMode(true); | 231 | 230 | this.terminal = true; | @@ -336,7 +335,6 @@ Interface.prototype._addHistory = function() { | 336 | 335 | if (dupIndex !== -1) this.history.splice(dupIndex, 1); | 337 | 336 | } | 338 | 337 |
| 339 | | - this.multiline += this.line; | 340 | 338 | this.history.unshift(this.line); | 341 | 339 |
| 342 | 340 | // Only store so many | @@ -347,29 +345,6 @@ Interface.prototype._addHistory = function() { | 347 | 345 | return this.history[0]; | 348 | 346 | }; | 349 | 347 |
| 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 | | - const dupIndex = 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 | | -}; | 373 | 348 |
| 374 | 349 | Interface.prototype._refreshLine = function() { | 375 | 350 | // line length | |
Collapse file Copy file name to clipboardExpand all lines: lib/repl.js -2Lines changed: 0 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -773,7 +773,6 @@ exports.start = function(prompt, | 773 | 773 |
| 774 | 774 | REPLServer.prototype.clearBufferedCommand = function clearBufferedCommand() { | 775 | 775 | this[kBufferedCommandSymbol] = ''; | 776 | | - REPLServer.super_.prototype.multilineHistory.call(this); | 777 | 776 | }; | 778 | 777 |
| 779 | 778 | REPLServer.prototype.close = function close() { | @@ -888,7 +887,6 @@ REPLServer.prototype.displayPrompt = function(preserveCursor) { | 888 | 887 | const len = this.lines.level.length ? this.lines.level.length - 1 : 0; | 889 | 888 | const levelInd = '..'.repeat(len); | 890 | 889 | prompt += levelInd + ' '; | 891 | | - REPLServer.super_.prototype.undoHistory.call(this); | 892 | 890 | } | 893 | 891 |
| 894 | 892 | // Do not overwrite `_initialPrompt` here | |
Collapse file Copy file name to clipboardExpand all lines: test/parallel/test-repl-persistent-history.js -7Lines changed: 0 additions & 7 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -111,13 +111,6 @@ const tests = [ | 111 | 111 | test: [UP], | 112 | 112 | expected: [prompt, replFailedRead, prompt, replDisabled, prompt] | 113 | 113 | }, | 114 | | - { // Tests multiline history | 115 | | - env: {}, | 116 | | - test: ['{', '}', UP, CLEAR], | 117 | | - expected: [prompt, '{', '... ', '}', '{}\n', | 118 | | - prompt, `${prompt}{}`, prompt], | 119 | | - clean: false | 120 | | - }, | 121 | 114 | { | 122 | 115 | before: function before() { | 123 | 116 | if (common.isWindows) { | |
|