diff --git a/src/renderer/base/RenderClusterIterator.cpp b/src/renderer/base/RenderClusterIterator.cpp index aa54c029df46..3b00f0d29e29 100644 --- a/src/renderer/base/RenderClusterIterator.cpp +++ b/src/renderer/base/RenderClusterIterator.cpp @@ -55,7 +55,8 @@ RenderClusterIterator& RenderClusterIterator::operator+=(const ptrdiff_t& moveme size_t cols = 0; while (move > 0 && !_exceeded) { - if (!(*newCellIter).DbcsAttr().IsTrailing()) + bool skip = (*newCellIter).DbcsAttr().IsTrailing(); + if (!skip) { cols += (*newCellIter).Columns(); } @@ -65,9 +66,10 @@ RenderClusterIterator& RenderClusterIterator::operator+=(const ptrdiff_t& moveme } while (move < 0 && !_exceeded) { - if (!(*newCellIter).DbcsAttr().IsTrailing()) + bool skip = (*newCellIter).DbcsAttr().IsTrailing(); + if (!skip) { - cols += (*newCellIter).Columns(); + cols -= (*newCellIter).Columns(); } --newCellIter; _exceeded = !(newCellIter && (*newCellIter).TextAttr() == _attr); diff --git a/src/renderer/gdi/paint.cpp b/src/renderer/gdi/paint.cpp index 86c5012f5387..f905b742039a 100644 --- a/src/renderer/gdi/paint.cpp +++ b/src/renderer/gdi/paint.cpp @@ -314,15 +314,15 @@ using namespace Microsoft::Console::Render; while (clusterIter) { const auto& cluster = (*clusterIter); + const auto columnCount = cluster.GetColumns(); + // Our GDI renderer hasn't and isn't going to handle things above U+FFFF or sequences. // So replace anything complicated with a replacement character for drawing purposes. pwsPoly += cluster.GetTextAsSingle(); - rgdxPoly.emplace_back(gsl::narrow(cluster.GetColumns()) * coordFontSize.X); + rgdxPoly.emplace_back(gsl::narrow(columnCount) * coordFontSize.X); cchCharWidths += rgdxPoly.at(i); - const auto columnCount = cluster.GetColumns(); - - ++clusterIter; + clusterIter += columnCount > 0 ? columnCount : 1; ++i; } diff --git a/src/renderer/vt/ut_lib/vt.unittest.vcxproj b/src/renderer/vt/ut_lib/vt.unittest.vcxproj index b2f71422a17a..5bc130615f97 100644 --- a/src/renderer/vt/ut_lib/vt.unittest.vcxproj +++ b/src/renderer/vt/ut_lib/vt.unittest.vcxproj @@ -18,5 +18,5 @@ - +