GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — repl: handle buffered string logic on finish · nodejs/node@bd8be40

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • lib
    • readline.js
    • repl.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎lib/readline.js‎

Copy file name to clipboardExpand all lines: lib/readline.js
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -348,9 +348,9 @@ Interface.prototype.undoHistory = function() {
348348

349349
// If it's a multiline code, then add history
350350
// accordingly.
351-
Interface.prototype.multilineHistory = function() {
352-
// check if we got a multiline code
353-
if (this.multiline !== '' && this.terminal) {
351+
Interface.prototype.multilineHistory = function(clearBuffer) {
352+
// if not clear buffer, add multiline history
353+
if (!clearBuffer && this.terminal) {
354354
const dupIndex = this.history.indexOf(this.multiline);
355355
if (dupIndex !== -1) this.history.splice(dupIndex, 1);
356356
// Remove the last entered line as multiline
Collapse file

‎lib/repl.js‎

Copy file name to clipboardExpand all lines: lib/repl.js
+7-1Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -668,6 +668,13 @@ function REPLServer(prompt,
668668
}
669669
}
670670

671+
// handle multiline history
672+
if (self[kBufferedCommandSymbol].length)
673+
REPLServer.super_.prototype.multilineHistory.call(self, false);
674+
else {
675+
REPLServer.super_.prototype.multilineHistory.call(self, true);
676+
}
677+
671678
// Clear buffer if no SyntaxErrors
672679
self.clearBufferedCommand();
673680
sawCtrlD = false;
@@ -774,7 +781,6 @@ exports.start = function(prompt,
774781

775782
REPLServer.prototype.clearBufferedCommand = function clearBufferedCommand() {
776783
this[kBufferedCommandSymbol] = '';
777-
REPLServer.super_.prototype.multilineHistory.call(this);
778784
};
779785

780786
REPLServer.prototype.close = function close() {

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.