From f8305e8e0460fe2e001ae2f603613d83c250d6a2 Mon Sep 17 00:00:00 2001 From: James Holderness Date: Sun, 13 Dec 2020 14:34:45 +0000 Subject: [PATCH 1/2] Fix color selection range. --- src/host/selectionInput.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/host/selectionInput.cpp b/src/host/selectionInput.cpp index afb5831a982..1a6785d799b 100644 --- a/src/host/selectionInput.cpp +++ b/src/host/selectionInput.cpp @@ -717,7 +717,11 @@ bool Selection::_HandleColorSelection(const INPUT_KEY_INFO* const pInputKeyInfo) } else { - ColorSelection(_srSelectionRect, selectionAttr); + const auto selectionRects = GetSelectionRects(); + for (const auto& selectionRect : selectionRects) + { + ColorSelection(selectionRect, selectionAttr); + } ClearSelection(); } From 35ebfa5c03a2cb70ad06587ab40dcb61676da43c Mon Sep 17 00:00:00 2001 From: James Holderness Date: Sun, 13 Dec 2020 14:37:48 +0000 Subject: [PATCH 2/2] Fix DBCS support in find-and-color operation. --- src/host/selectionInput.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/host/selectionInput.cpp b/src/host/selectionInput.cpp index 1a6785d799b..70b4d4f3842 100644 --- a/src/host/selectionInput.cpp +++ b/src/host/selectionInput.cpp @@ -692,12 +692,13 @@ bool Selection::_HandleColorSelection(const INPUT_KEY_INFO* const pInputKeyInfo) std::wstring str; for (const auto& selectRect : selectionRects) { - auto it = screenInfo.GetTextDataAt(COORD{ selectRect.Left, selectRect.Top }); + auto it = screenInfo.GetCellDataAt(COORD{ selectRect.Left, selectRect.Top }); - for (SHORT i = 0; i < (selectRect.Right - selectRect.Left + 1); ++i) + for (SHORT i = 0; i < (selectRect.Right - selectRect.Left + 1);) { - str.append((*it).begin(), (*it).end()); - it++; + str.append(it->Chars()); + i += gsl::narrow_cast(it->Columns()); + it += it->Columns(); } }