-
Notifications
You must be signed in to change notification settings - Fork 8.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Behaviour of click-and-drag text selection depends inconsistently on prior pane and application focus state #4282
Comments
Yeah, this is definitely something that we should fix. Thanks for the comprehensive report! @carlos-zamora I was talking about the issues with beginning/ending selections on things that are/are not focused, and how we need to comport that with "don't select a single cell when the user brings the terminal window to the front by clicking inside it." Can you find the duplicates here? |
## Summary of the Pull Request This PR tries to address some of the weird interactions with pointer pressed events when the Terminal isn't in focus. Here's the four things that have changed as part of this PR; 1. This PR will allow the user to be able to make a selection with a click-drag without having to first perform a single click on a tab/pane to bring it to focus. 2. Another weird bug that's fixed in this PR is where trying to make a selection on an unfocused tab when it already has a selection active will simply extend the existing selection instead of making a new one. 3. Not related to the issue that his PR closes: a right click will now focus the tab/pane. I've made sure that we still have the existing functionality where a single click on an unfocused tab/pane does not make a single-cell selection and just focuses the tab/pane. ## PR Checklist * [x] Closes #4282 * [x] CLA signed. If not, go over [here](https://cla.opensource.microsoft.com/microsoft/Terminal) and sign the CLA * [x] Tests added/passed ## Validation Steps Performed Played around with all sorts of selection when in-focus and out of focus with multiple panes and tabs. Unit tests still pass as well.
🎉This issue was addressed in #4506, which has now been successfully released as Handy links: |
This commit rewrites selection handling at the TermControl layer. Previously, we were keeping track of a number of redundant variables that were easy to get out of sync. The new selection model is as follows: * A single left click will always begin a _pending_ selection operation * A single left click will always clear a selection (#4477) * A double left click will always begin a word selection * A triple left click will always begin a line selection * A selection will only truly start when the cursor moves a quarter of the smallest dimension of a cell (usually its width) in any direction _This eliminates the selection of a single cell on one click._ (#4282, #5082) * We now keep track of whether the selection has been "copied", or "updated" since it was last copied. If an endpoint moves, it is updated. For copy-on-select, it is only copied if it's updated. (#4740) Because of this, we can stop tracking the position of the focus-raising click, and whether it was part of click-drag operation. All clicks can _become_ part of a click-drag operation if the user drags. We can also eliminate the special handling of single cell selection at the TerminalCore layer: since TermControl determines when to begin a selection, TerminalCore no longer needs to know whether copy on select is enabled _or_ whether the user has started and then backtracked over a single cell. This is now implicit in TermControl. Fixes #4082; Fixes #4477
This commit rewrites selection handling at the TermControl layer. Previously, we were keeping track of a number of redundant variables that were easy to get out of sync. The new selection model is as follows: * A single left click will always begin a _pending_ selection operation * A single left click will always clear a selection (#4477) * A double left click will always begin a word selection * A triple left click will always begin a line selection * A selection will only truly start when the cursor moves a quarter of the smallest dimension of a cell (usually its width) in any direction _This eliminates the selection of a single cell on one click._ (#4282, #5082) * We now keep track of whether the selection has been "copied", or "updated" since it was last copied. If an endpoint moves, it is updated. For copy-on-select, it is only copied if it's updated. (#4740) Because of this, we can stop tracking the position of the focus-raising click, and whether it was part of click-drag operation. All clicks can _become_ part of a click-drag operation if the user drags. We can also eliminate the special handling of single cell selection at the TerminalCore layer: since TermControl determines when to begin a selection, TerminalCore no longer needs to know whether copy on select is enabled _or_ whether the user has started and then backtracked over a single cell. This is now implicit in TermControl. Fixes #5082; Fixes #4477
Environment
NB: I have copy-on-select enabled, although I suspect it doesn't matter.
Steps to reproduce
The need for step 4 isn't ideal (other apps don't work this way), but it is reasonably intuitive and easy to recover from. But let's see what happens when we have two panes open and we try to select the "wrong" one:
I've also noticed that, once an unfocused pane has a selection, clicking and dragging in that pane seems to ignore the click point (perhaps it never gets the click event?) and treat the drag as a continuation of the prior selection.
Expected behavior
I should be able to select text by clicking and dragging over it:
Actual behavior
Described above.
The fact that each pane has its own selection (so you can select text concurrently in multiple panes) might be a useful feature, but it seems to cause a lot of strange inconsistencies with text selection and copy/paste.
The text was updated successfully, but these errors were encountered: