terminal icon indicating copy to clipboard operation
terminal copied to clipboard

Duplicate copyOnSelect actions part 2

Open maguiresf opened this issue 6 years ago • 5 comments

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.

  1. Open WSL Ubuntu terminal
  2. Split pane in two: pane_1 and pane_2
  3. Select a block on text with copyOnSelect enabled (for example "TEST1") on pane_1
  4. Ensure block of text remains highlighted
  5. Make pane_2 the active pane
  6. Switch to notepad instance
  7. Paste selected text into Notepad
  8. Make some change to text, (for example change string to "TEST999")
  9. Copy string inside Notepad
  10. Highlight Windows Terminal, clicking into the last active pane (pane_2)
  11. Paste string into Windows Terminal
  12. Now highlight the other pane (pane_1) that still has the original string highlighted
  13. Paste again

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

maguiresf avatar Feb 28 '20 14:02 maguiresf

Thanks for the great repro steps!

zadjii-msft avatar Feb 28 '20 15:02 zadjii-msft

@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.

leonMSFT avatar Mar 04 '20 20:03 leonMSFT

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?

DHowett-MSFT avatar Mar 04 '20 20:03 DHowett-MSFT

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.

leonMSFT avatar Mar 04 '20 21:03 leonMSFT

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.

maguiresf avatar Mar 06 '20 16:03 maguiresf