File tree Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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
775782REPLServer . prototype . clearBufferedCommand = function clearBufferedCommand ( ) {
776783 this [ kBufferedCommandSymbol ] = '' ;
777- REPLServer . super_ . prototype . multilineHistory . call ( this ) ;
778784} ;
779785
780786REPLServer . prototype . close = function close ( ) {
You can’t perform that action at this time.
0 commit comments