File tree 1 file changed +14
-3
lines changed 1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -760,11 +760,22 @@ void UpdateColorsIfNecessary(string newColor)
760
760
}
761
761
762
762
// Fewer logical lines than our previous render? Clear them.
763
- for ( ; previousLogicalLine < previousRenderLines . Length ; previousLogicalLine ++ )
763
+ for ( int line = previousLogicalLine ; line < previousRenderLines . Length ; line ++ )
764
764
{
765
+ if ( line > previousLogicalLine || logicalLineStartIndex < renderLines . Length )
766
+ {
767
+ // For the first of the remaining previous logical lines, if we didn't actually
768
+ // render anything for the current logical lines, then the cursor is already at
769
+ // the beginning of the right physical line that should be cleared, and thus no
770
+ // need to write a new line in such case.
771
+ // In other cases, we need to write a new line to get the cursor to the correct
772
+ // physical line.
773
+
774
+ _console . Write ( "\n " ) ;
775
+ }
776
+
765
777
// No need to write new line if all we need is to clear the extra previous render.
766
- if ( logicalLineStartIndex < renderLines . Length ) { _console . Write ( "\n " ) ; }
767
- _console . Write ( Spaces ( previousRenderLines [ previousLogicalLine ] . columns ) ) ;
778
+ _console . Write ( Spaces ( previousRenderLines [ line ] . columns ) ) ;
768
779
}
769
780
770
781
// Preserve the current render data.
You can’t perform that action at this time.
0 commit comments