From 416be4656febb708193ed7ecc36914c6e98c1333 Mon Sep 17 00:00:00 2001 From: Mike Griese Date: Tue, 14 Jan 2020 16:46:33 -0600 Subject: [PATCH] This is some cleanup, almost ready for PR but I need to write tests which are blocked on #4213 --- src/renderer/vt/paint.cpp | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/renderer/vt/paint.cpp b/src/renderer/vt/paint.cpp index 6edf254bd96..bda79f6197a 100644 --- a/src/renderer/vt/paint.cpp +++ b/src/renderer/vt/paint.cpp @@ -376,10 +376,6 @@ using namespace Microsoft::Console::Types; return S_OK; } - // auto lastPaintWrapped = _wrappedRow; - - // RETURN_IF_FAILED(_MoveCursor(coord)); - std::wstring unclusteredString; unclusteredString.reserve(clusters.size()); short totalWidth = 0; @@ -447,14 +443,19 @@ using namespace Microsoft::Console::Types; (totalWidth - numSpaces) : totalWidth; - if (removeSpaces && _wrappedRow.has_value() /* && columnsActual == 0*/) + if (cchActual == 0) { - // If the previous row _exactly_ filled the line, and we're about to - // clear _the entire line_, then we actually do want to move the - // cursor down. - // RETURN_IF_FAILED(_MoveCursor(coord)); + // If the previous row wrapped, but this line is empty, then we actually + // do want to move the cursor down. Otherwise, we'll possibly end up + // accidentally erasing the last character from the previous line, as + // the cursor is still waiting on that character for the next character + // to follow it. _wrappedRow = std::nullopt; + // TODO:: Write a test that emulates ~/vttests/reflow-120.py + // TODO:: Write a test that emulates ~/vttests/reflow-advanced.py } + + // Move the cursor to the start of this run. RETURN_IF_FAILED(_MoveCursor(coord)); // Write the actual text string @@ -468,9 +469,6 @@ using namespace Microsoft::Console::Types; // line. // Don't do this is the last character we're writing is a space - The last // char will always be a space, but if we see that, we shouldn't wrap. - - // TODO: This seems to be off by one char. Resizing cmd.exe, the '.' at the - // end of the initial message sometimes gets cut off weirdly. if ((_lastText.X + (totalWidth - numSpaces)) > _lastViewport.RightInclusive()) { _wrappedRow = coord.Y;