Selection Code Cleanup and Double Click Delimiter Runs#2511
Selection Code Cleanup and Double Click Delimiter Runs#2511DHowett-MSFT merged 14 commits intomasterfrom
Conversation
- selectionVerticalOffset - proper return values (const) - Break up GetSelectionRects()
More cleanup
|
NOTE: Double Click Delimiter runs in this isn't quite right yet. Dustin and I agreed on a new model:
double clicking a cell containing class
|
Add test (caught a minor thing because of that)
| } | ||
| } | ||
|
|
||
| TEST_METHOD(SelectToOutOfBounds) |
There was a problem hiding this comment.
Per some of my comments above, I'd love to see some tests exercising what happens when clearly invalid things are being put into your movement functions like moving left but the left is already left of the viewport.
There was a problem hiding this comment.
(also some overflows, probably, given we're using SHORTs here and overflows aren't an impossibility.)
|
Hey, x86 spontaneously failed! They're all in Griese's App tests though.. |
|
|
zadjii-msft
left a comment
There was a problem hiding this comment.
Overall seems good, kinda minor nits from me
zadjii-msft
left a comment
There was a problem hiding this comment.
I'm definitely happier with this now
remove some const return values that are unneccesary
| // - the selection row needed for rendering | ||
| SMALL_RECT Terminal::_GetSelectionRow(const SHORT row, const COORD higherCoord, const COORD lowerCoord) const | ||
| { | ||
| SMALL_RECT selectionRow; |
There was a problem hiding this comment.
nit: Even though each member of SMALL_RECT gets set currently it is best practice to always initialize a struct. I am not sure what the team's stance is on this though.
SMALL_RECT selectionRow{0};
Add/Fix Tests
Also added overflow tests.
|
🎉 Handy links: |
Summary of the Pull Request
Just some housekeeping work on our selection. Added a few more tests and refactored some of the functionality to improve code clarity.
Reenabled x86 tests. They work on my machine. I hope they work on CI?
Added support for double clicking delimiter runs.
Double Click Delimiter runs now operate as follows. Characters are separated into 3 classes:
If you double click a cell, the selection will expand until the class of the next cell differs from the preceding one.
This is slightly different than before in that the following example will only highlight the ">" char instead of the ">" and all the surrounding spaces:
References
N/A
PR Checklist
Requires documentation to be updatedDetailed Description of the Pull Request / Additional comments
Added some testing to ensure we don't crash on out-of-bounds selection anchors.
Consolidated the vertical offset for the anchors since they're always the same.
Broke up
GetSelectionRects()into a more clear format with several helper methods.Validation Steps Performed
All tests pass. I manually did some ALT+selections and regular selections w/ and w/out the scroll area and it still seems fine.