Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix color selection operations in conhost (microsoft#8577)
In conhost there is a keyboard shortcut that applies colors to the selected range of text, and another shortcut that searches for the selected text, and applies colors to any matching content. The former operation doesn't work correctly when the selection is wrapped, and both have problems when the selected text spans DBCS characters. This PR attempts to fix those issues. The problem with the color section was that it applied the color to a simple rect spanning the start and end points of the selection. I've now updated it to use the `Selection::GetSelectionRects` method, which correctly handles a wrapped range of lines, and makes sure that double width characters are fully covered. The problem with the "find-and-color" operation was in the way it obtained the search text from the selected screen cells. Since it retrieved one cell at a time, and a DBCS character can span two cells, that resulted in some characters being repeated in the search text. I've now corrected that code to take the width of the characters into account. ## Validation Steps Performed I've manually verified that the test cases described in microsoft#8572 and microsoft#8574 are now working correctly. Closes microsoft#8572 Closes microsoft#8574
- Loading branch information