Skip to content

Conversation

@vidmt
Copy link

@vidmt vidmt commented Nov 11, 2025

This fixes issue #272894 where the terminal's copyOnSelection feature would unintentionally select matches from command-f search and overwrite the clipboard when the find widget highlights search results. Previously, programmatic selections caused by search highlights were treated the same as user selections, triggering the copy-on-selection behavior.

How it fixes the issue

  • I added a guard in TerminalClipboardContribution to detect when the FindWidget is active.
  • When find triggers and highlights most recent match, CopyOnSelection is blocked from copying
  • This prevents copying to clipboard if the selection originates from the find widget rather than a user action.

How to test

  1. Open the terminal in VS Code.
  2. Ensure terminal.integrated.copyOnSelection is enabled.
  3. Open the find widget and search for a term in the terminal.
  4. Verify that interacting with the terminal (typing, pasting) does not overwrite your system clipboard with the search highlight.
  5. Make a normal selection in the terminal; the copy-on-selection behavior should still work as expected.

@vidmt
Copy link
Author

vidmt commented Nov 11, 2025

@vidmt please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.

@microsoft-github-policy-service agree [company="{your company}"]

Options:

  • (default - no company specified) I have sole ownership of intellectual property rights to my Submissions and I am not making Submissions in the course of work for my employer.
@microsoft-github-policy-service agree
  • (when company given) I am making Submissions in the course of work for my employer (or my employer has intellectual property rights in my Submissions by contract or applicable law). I have permission from my employer to make Submissions and enter into this Agreement on behalf of my employer. By signing below, the defined term “You” includes me and my employer.
@microsoft-github-policy-service agree company="Microsoft"

Contributor License Agreement

@microsoft-github-policy-service agree

@vidmt
Copy link
Author

vidmt commented Nov 13, 2025

BugFix.mov

Here's a video demonstrating the original bug and the fix I made. This fixes the original bug while also maintaining the intended behavior of allowing the user's selections to be copied when the find widget is open.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants