File tree Expand file tree Collapse file tree 1 file changed +9
-17
lines changed Expand file tree Collapse file tree 1 file changed +9
-17
lines changed Original file line number Diff line number Diff line change @@ -630,22 +630,6 @@ function run_repl(err, rl) {
630
630
function should_update ( ) {
631
631
return ( token || prev_token ) && code_above && ! string . match ( / ^ [ \n \r ] + $ / ) ;
632
632
}
633
- function refresh ( ) {
634
- // this always need to be executed inside rl._writeToOutput
635
- // even if nothing changes, this make sure that the input
636
- // stay intact while editing the command line
637
- rl . output . write ( code ) ;
638
- }
639
- function finalize ( ) {
640
- if ( should_update ( ) ) {
641
- setTimeout ( ( ) => {
642
- // overwrite lines above the cursor this is side effect
643
- process . stdout . write ( '\x1b7' + ansi_rewrite_above ( code_above ) + '\x1b8' ) ;
644
- } , 0 ) ;
645
- }
646
- refresh ( ) ;
647
- prev_token = token ;
648
- }
649
633
let token , code_above , code ;
650
634
try {
651
635
const prefix = multiline ? continue_prompt : prompt ;
@@ -676,8 +660,16 @@ function run_repl(err, rl) {
676
660
}
677
661
}
678
662
}
663
+ if ( should_update ( ) ) {
664
+ // overwrite lines above the cursor this is side effect
665
+ process . stdout . write ( '\x1b7' + ansi_rewrite_above ( code_above ) + '\x1b8' ) ;
666
+ }
667
+ prev_token = token ;
679
668
}
680
- finalize ( ) ;
669
+ // this always need to be executed inside rl._writeToOutput
670
+ // even if nothing changes, this make sure that the input
671
+ // stay intact while editing the command line
672
+ rl . output . write ( code ) ;
681
673
} catch ( e ) {
682
674
console . error ( e ) ;
683
675
}
You can’t perform that action at this time.
0 commit comments