Skip to content

Commit

Permalink
Fix marking of new selection start (#9727)
Browse files Browse the repository at this point in the history
## PR Checklist
* [x] Closes #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
  • Loading branch information
Don-Vito authored Apr 6, 2021
1 parent 6ca35b4 commit e80e9b9
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/cascadia/TerminalControl/TermControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit e80e9b9

Please sign in to comment.