-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Duplicate copyOnSelect actions part 2 #4740
Comments
Thanks for the great repro steps! |
@maguiresf Just to see if I'm understanding the steps correctly, in Step 12, you're simply refocusing pane_1 by single clicking on it right? In addition, throughout all the steps, TEST1 is still highlighted on pane_1? If what I described is correct, the behavior we've coded for is to only copy to clipboard the first time a selection is made, and so since "TEST1" was selected for the first time on Step 3, that's the only time "TEST1" will be copied to the clipboard. Refocusing on a pane with a selection active should not trigger a copy on select on that selection. This is the behavior that was expected in #4255. So, in step 12, refocusing pane_1 will not recopy "TEST1" to the clipboard, which is why "TEST999" (which was copied from notepad) is pasted. |
Nah, this does repro for me. The right-click paste in pane 2 causes a copy of pane 2's selection. Should we just suppress right-click copy in CoS cases? |
Argh you're right, it's the right click that repros, I think it's reasonable to suppress right-click copy in this case then. |
Ah, apologies, I should have mentioned I was using right-click to paste. I'd just found another variation of this involving switching between tabs and panes but it again only appears to be triggered when using right-click to paste so it looks like it must be the same issue. |
<!-- Enter a brief description/summary of your PR here. What does it fix/what does it change/how was it tested (even manually, if necessary)? --> ## Summary of the Pull Request Right clicking on a focused tab while Copy On Select is active currently copies any active selection. This is because `PointerReleasedHandler` doesn't check for the mouse button that was released. During a mouse button release, only the left mouse button release should be doing anything. <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist * [x] Closes #4740 * [x] CLA signed. * [x] Tests added/passed <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> ## Validation Steps Performed These are the scenarios I've tested. They're a combination of in focus/out of focus, Copy On Select on/off, left/right click pressed and their move and release variants. From Out of Focus: - Left Click = Focus - Left Click Move = Focus + Selection - Left Click Release - CoS on = Copy - CoS off = Nothing - Shift Left Click = Focus - Right Click - Focus - CoS on = Paste - CoS off = Copy if Active Selection, Paste if not. - Right Click Move = Nothing - Right Click Release = Nothing From In Focus - Left Click = Selection if CoS off - Left Click Move = Selection - Left Click Release - CoS on = Copy - CoS off = Nothing - Shift Left Click = Set Selection Anchor - Right Click - CoS on = Paste - CoS off = Copy if Active Selection, Paste if not. - Right Click Move = Nothing - Right Click Release = Nothing
<!-- Enter a brief description/summary of your PR here. What does it fix/what does it change/how was it tested (even manually, if necessary)? --> ## Summary of the Pull Request Right clicking on a focused tab while Copy On Select is active currently copies any active selection. This is because `PointerReleasedHandler` doesn't check for the mouse button that was released. During a mouse button release, only the left mouse button release should be doing anything. <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist * [x] Closes microsoft#4740 * [x] CLA signed. * [x] Tests added/passed <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> ## Validation Steps Performed These are the scenarios I've tested. They're a combination of in focus/out of focus, Copy On Select on/off, left/right click pressed and their move and release variants. From Out of Focus: - Left Click = Focus - Left Click Move = Focus + Selection - Left Click Release - CoS on = Copy - CoS off = Nothing - Shift Left Click = Focus - Right Click - Focus - CoS on = Paste - CoS off = Copy if Active Selection, Paste if not. - Right Click Move = Nothing - Right Click Release = Nothing From In Focus - Left Click = Selection if CoS off - Left Click Move = Selection - Left Click Release - CoS on = Copy - CoS off = Nothing - Shift Left Click = Set Selection Anchor - Right Click - CoS on = Paste - CoS off = Copy if Active Selection, Paste if not. - Right Click Move = Nothing - Right Click Release = Nothing
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
Platform ServicePack Version VersionString
Win32NT 10.0.18363.0 Microsoft Windows NT 10.0.18363.0
Windows Terminal Version 0.9.433.0
Steps to reproduce
Please note, this isn't a duplicate of issue #4255 which I reported previously, it's a variation of the same issue which is still present in the latest version where as 4255 is now fixed.
Expected behavior
In both steps 11 and 13, the last copied string, "TEST999", is pasted
Actual behavior
In step 11, TEST999 is pasted
In step 13, TEST1 is pasted
The text was updated successfully, but these errors were encountered: