File tree Expand file tree Collapse file tree 1 file changed +14
-3
lines changed
Expand file tree Collapse file tree 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)
760760 }
761761
762762 // Fewer logical lines than our previous render? Clear them.
763- for ( ; previousLogicalLine < previousRenderLines . Length ; previousLogicalLine ++ )
763+ for ( int line = previousLogicalLine ; line < previousRenderLines . Length ; line ++ )
764764 {
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+
765777 // 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 ) ) ;
768779 }
769780
770781 // Preserve the current render data.
You can’t perform that action at this time.
0 commit comments