@@ -552,8 +552,13 @@ public static async System.Threading.Tasks.Task<ExitCodes> UpdateFirmwareAsync(
552
552
553
553
if ( verbosity >= VerbosityLevel . Normal )
554
554
{
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 ) ;
557
562
558
563
OutputWriter . ForegroundColor = ConsoleColor . White ;
559
564
OutputWriter . Write ( $ "Backup configuration...") ;
@@ -583,15 +588,21 @@ public static async System.Threading.Tasks.Task<ExitCodes> UpdateFirmwareAsync(
583
588
if ( verbosity >= VerbosityLevel . Normal )
584
589
{
585
590
// 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 ) ;
588
599
589
600
// operation completed output
590
601
// output the full message as usual after the progress from esptool
591
602
OutputWriter . ForegroundColor = ConsoleColor . White ;
592
603
OutputWriter . Write ( $ "Flashing firmware...") ;
593
604
OutputWriter . ForegroundColor = ConsoleColor . Green ;
594
- OutputWriter . WriteLine ( "OK" . PadRight ( 110 ) ) ;
605
+ OutputWriter . WriteLine ( "OK" . PadRight ( Console . WindowWidth - Console . CursorLeft ) ) ;
595
606
596
607
// warn user if reboot is not possible
597
608
if ( espTool . CouldntResetTarget )
0 commit comments