Fix color selection operations in conhost#8577
Merged
2 commits merged intomicrosoft:mainfrom Dec 14, 2020
Merged
Conversation
zadjii-msft
approved these changes
Dec 14, 2020
DHowett
approved these changes
Dec 14, 2020
Member
DHowett
left a comment
There was a problem hiding this comment.
This looks great. Thanks again for the attention to detail 😄
|
Hello @DHowett! Because this pull request has the p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (
|
Member
|
Good call. Thank you. |
|
🎉 Handy links: |
This was referenced Jan 28, 2021
mpela81
pushed a commit
to mpela81/terminal
that referenced
this pull request
Jan 28, 2021
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
This pull request was closed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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::GetSelectionRectsmethod, whichcorrectly 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 #8572 and #8574
are now working correctly.
Closes #8572
Closes #8574