@@ -552,8 +552,13 @@ public static async System.Threading.Tasks.Task<ExitCodes> UpdateFirmwareAsync(
552552
553553 if ( verbosity >= VerbosityLevel . Normal )
554554 {
555- // move cursor up and clear line
556- OutputWriter . Write ( "\u001b [A\r \u001b [K" ) ;
555+ // clear output of the progress from esptool, move cursor up and clear line
556+ Console . SetCursorPosition ( 0 , Console . CursorTop ) ;
557+ Console . Write ( new string ( ' ' , Console . WindowWidth ) ) ;
558+ int currentLineCursor = Console . CursorTop ;
559+ Console . SetCursorPosition ( 0 , currentLineCursor - 1 ) ;
560+ Console . Write ( new string ( ' ' , Console . WindowWidth ) ) ;
561+ Console . SetCursorPosition ( 0 , currentLineCursor - 1 ) ;
557562
558563 OutputWriter . ForegroundColor = ConsoleColor . White ;
559564 OutputWriter . Write ( $ "Backup configuration...") ;
@@ -583,15 +588,21 @@ public static async System.Threading.Tasks.Task<ExitCodes> UpdateFirmwareAsync(
583588 if ( verbosity >= VerbosityLevel . Normal )
584589 {
585590 // output the start of operation message for verbosity normal and above
586- // move cursor up and clear line
587- OutputWriter . Write ( "\u001b [A\r \u001b [K" ) ;
591+
592+ // clear output of the progress from esptool, move cursor up and clear line
593+ Console . SetCursorPosition ( 0 , Console . CursorTop ) ;
594+ Console . Write ( new string ( ' ' , Console . WindowWidth ) ) ;
595+ int currentLineCursor = Console . CursorTop ;
596+ Console . SetCursorPosition ( 0 , currentLineCursor - 1 ) ;
597+ Console . Write ( new string ( ' ' , Console . WindowWidth ) ) ;
598+ Console . SetCursorPosition ( 0 , currentLineCursor - 1 ) ;
588599
589600 // operation completed output
590601 // output the full message as usual after the progress from esptool
591602 OutputWriter . ForegroundColor = ConsoleColor . White ;
592603 OutputWriter . Write ( $ "Flashing firmware...") ;
593604 OutputWriter . ForegroundColor = ConsoleColor . Green ;
594- OutputWriter . WriteLine ( "OK" . PadRight ( 110 ) ) ;
605+ OutputWriter . WriteLine ( "OK" . PadRight ( Console . WindowWidth - Console . CursorLeft ) ) ;
595606
596607 // warn user if reboot is not possible
597608 if ( espTool . CouldntResetTarget )
0 commit comments