Fix marking of new selection start (#9727)

## PR Checklist
* [x] Closes https://github.com/microsoft/terminal/issues/9725
* [x] CLA signed. 
* [ ] Tests added/passed
* [ ] Documentation updated. 
* [ ] Schema updated.
* [ ] I've discussed this with core contributors already. 

## Validation Steps Performed
* [x] single click = no selection
* [x] single click and drag = selection starting from first point
* [x] single click in unfocused pane and drag = focus pane, selection starting from first point
* [x] double-click = selects a whole word
* [x] triple-click = selects a whole line
* [x] double-click and drag = selects a whole word, drag selects whole words
* [x] triple-click and drag = selects a whole line, drag selects whole lines
* [x] Shift single-click = defines start point
* [x] second Shift single-click = defines end point
* [x] Shift double-click = selects entire word
* [x] Shift triple-click = selects entire line
* [x] Shift double-click and drag = selects entire word, drag selects whole words
* [x] Mouse mode: Shift single-click = defines start point
* [x] Mouse mode: second Shift single-click = defines end point
* [x] Mouse mode: Shift double-click = selects entire word
* [x] Mouse mode: Shift triple-click = selects entire line
* [x] Mouse mode: Shift double-click and drag = selects entire word, drag selects whole words
* [x] With existing selection: single-click outside the selection and drag = establishes a new selection starting from the click point
This commit is contained in:
Don-Vito 2021-04-06 22:17:26 +03:00 committed by GitHub
parent 6ca35b4445
commit e80e9b9e96
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1348,11 +1348,14 @@ namespace winrt::Microsoft::Terminal::Control::implementation
mode = ::Terminal::SelectionExpansionMode::Line;
}
// Capture the position of the first click when no selection is active
if (mode == ::Terminal::SelectionExpansionMode::Cell && !_terminal->IsSelectionActive())
// Capture the position of the first click
if (mode == ::Terminal::SelectionExpansionMode::Cell)
{
_singleClickTouchdownPos = cursorPosition;
_lastMouseClickPosNoSelection = cursorPosition;
if (!_terminal->IsSelectionActive())
{
_lastMouseClickPosNoSelection = cursorPosition;
}
}
// We reset the active selection if one of the conditions apply: