Skip to content

Commit

Permalink
Prevent mouse dragging from dismissing existing selection (#9790)
Browse files Browse the repository at this point in the history
## PR Checklist
* [x] Closes #9787
* [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 
* [x] Click-drag to set selection, shift-click-drag outside of selection = extend selection while dragging
  • Loading branch information
Don-Vito committed Apr 12, 2021
1 parent 7df4b3c commit b8e36ba
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/cascadia/TerminalControl/TermControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1422,6 +1422,13 @@ namespace winrt::Microsoft::Terminal::Control::implementation
_selectionNeedsToBeCopied = true;
}

if (_terminal->IsSelectionActive())
{
// GH#9787: if selection is active we don't want to track the touchdown position
// so that dragging the mouse will extend the selection rather than starting the new one
_singleClickTouchdownPos = std::nullopt;
}

_renderer->TriggerSelection();
}
else if (point.Properties().IsRightButtonPressed())
Expand Down

0 comments on commit b8e36ba

Please sign in to comment.