diff --git a/src/renderer/vt/paint.cpp b/src/renderer/vt/paint.cpp index bc1a7f9fbd2..920dc86aeb2 100644 --- a/src/renderer/vt/paint.cpp +++ b/src/renderer/vt/paint.cpp @@ -475,7 +475,6 @@ using namespace Microsoft::Console::Types; if (useEraseChar) { - RETURN_IF_FAILED(_EraseCharacter(sNumSpaces)); // ECH doesn't actually move the cursor itself. However, we think that // the cursor *should* be at the end of the area we just erased. Stash // that position as our new deferred position. If we don't move the @@ -483,6 +482,15 @@ using namespace Microsoft::Console::Types; // cursor to the deferred position at the end of the frame, or right // before we need to print new text. _deferredCursorPos = { _lastText.X + sNumSpaces, _lastText.Y }; + + if (_deferredCursorPos.X < _lastViewport.RightInclusive()) + { + RETURN_IF_FAILED(_EraseCharacter(sNumSpaces)); + } + else + { + RETURN_IF_FAILED(_EraseLine()); + } } else if (_newBottomLine) {