diff --git a/lib/node_modules/@stdlib/repl/lib/syntax_highlighter.js b/lib/node_modules/@stdlib/repl/lib/syntax_highlighter.js index dbe1c848f7d..f2d9c31df74 100644 --- a/lib/node_modules/@stdlib/repl/lib/syntax_highlighter.js +++ b/lib/node_modules/@stdlib/repl/lib/syntax_highlighter.js @@ -328,20 +328,20 @@ setNonEnumerableReadOnly( SyntaxHighlighter.prototype, 'onKeypress', function on if ( this._line !== this._rli.line ) { // Tokenize: debug( 'Line change detected. Tokenizing line: %s', this._rli.line ); - tokens = tokenizer( this._rli.line, this._repl._context ); + this._line = this._rli.line; // update line buffer + tokens = tokenizer( this._line, this._repl._context ); if ( isEmptyArray( tokens ) ) { debug( 'No tokens found. Skipping highlighting...' ); - this._multilineHandler.updateLine( this._rli.line ); // save displayed line - return; + this._highlightedLine = this._line; + } else { + // Process tokens: + tokens.sort( tokenComparator ); + tokens = removeDuplicateTokens( tokens ); + + // Highlight: + debug( '%d tokens found. Highlighting...', tokens.length ); + this._highlightedLine = this._highlightLine( this._line, tokens ); } - // Process tokens: - tokens.sort( tokenComparator ); - tokens = removeDuplicateTokens( tokens ); - - // Highlight: - debug( '%d tokens found. Highlighting...', tokens.length ); - this._line = this._rli.line; // updated line buffer - this._highlightedLine = this._highlightLine( this._line, tokens ); } // Replace: debug( 'Replacing current line with the highlighted line...' );