Chunk Selection Expansion for Double/Triple Click Selection#2184
Chunk Selection Expansion for Double/Triple Click Selection#2184DHowett-MSFT merged 11 commits intomasterfrom
Conversation
| } | ||
|
|
||
| // expand selection for Double/Triple Click | ||
| if (multiClickSelectionMode == selectionExpansionMode::Word && _selectionAnchor != _endSelectionPosition) |
zadjii-msft
left a comment
There was a problem hiding this comment.
I think I'd really love to see some extra tests added for this in the TerminalCore tests.
|
#Resolved |
| if (viewportPos.X < 0 || viewportPos.X > _buffer->GetSize().RightInclusive()) | ||
| { | ||
| return viewportPos; | ||
| THROW_HR(E_INVALIDARG); |
There was a problem hiding this comment.
Theoretically, we should never hit this case. But, if somebody somehow did a double click OUTSIDE of the terminal, I think it makes sense to clamp it to the nearest valid buffer cell. So how does this sound?
positionWithOffsets.X = std::clamp(viewportPos.X, static_cast<SHORT>(0), _buffer->GetSize().RightInclusive());
positionWithOffsets.Y = std::clamp(viewportPos.Y, static_cast<SHORT>(0), _buffer->GetSize().BottomInclusive());
Note that this is explicitly should not be clamped to the viewport to allow for selections outside of the region we can see. This mainly affects scroll interactions (i.e.: auto scroll, scrolling into an existing selection, etc...).
|
SA is out of disk space. |
|
🎉 Handy links: |

Summary of the Pull Request
Double/Triple click create a selection expanding beyond one cell. This PR makes it so that when you're dragging your mouse to expand the selection, you expand to the next delimiter defined by double/triple click.
So, double click expands by doubleClickDelimiter ranges. Triple click expands by line.
When you double/triple click, a word/line is selected. When you drag, that word/line will remain selected after the expansion occurs.
References
PR Checklist
added/passednot necessaryDetailed Description of the Pull Request / Additional comments
Rather than resizing the selection when the mouse event occurs, I figured I'd do what I did with wide glyph selection: expand at render time.
We needed an enum
multiClickSelectionModeto keep track of which expansion mode we're in.Minor modifications to
_ExpandDoubleClickSelection*(COORD)had to be made so that we can re-use them.Actual expansion occurs in
_GetSelectionRects()Validation Steps Performed
dirorlsdirorlsdirorlsdirorlsrepeat above tests in following scenarios: