Skip to content
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

Find/Replace on KDE Plasma unnecessarily overwrites clipboard when used with "clipboard selection sync" #197495

Open
sporeventexplosion opened this issue Nov 5, 2023 · 3 comments
Assignees
Labels
editor-find Editor find operations under-discussion Issue is under discussion for relevance, priority, approach

Comments

@sporeventexplosion
Copy link

sporeventexplosion commented Nov 5, 2023

Does this issue occur when all extensions are disabled?: Yes

Version: 1.85.0-insider
Commit: e550098
Date: 2023-11-03T15:12:10.231Z
Electron: 25.9.2
ElectronBuildId: 24603566
Chromium: 114.0.5735.289
Node.js: 18.15.0
V8: 11.4.183.29-electron.0
OS: Linux x64 6.2.0-36-generic

Steps to Reproduce:

  1. On KDE Plasma, open Klipper settings GUI and enable "Synchronize contents of the clipboard and the selection".
  2. Copy an arbitrary string to the clipboard.
  3. Open vscode with no extensions, create a new file, enter some text.
  4. Move text cursor inside one of the words, but don't select anything.
  5. Press Ctrl-F to search for the word under the current cursor. Doing this makes vscode prefill this word into the search box.
  6. Close search box and paste from clipboard.

Observed behavior

The string on the clipboard becomes the prefilled string in the search box.

Expected behavior

The original string on the clipboard is preserved.

This is the expected behavior as when focusing the address bar in Chrome and Firefox with this Klipper option enabled, the text in the address bar is auto-selected (so that it can be cleared automatically when typing a single keystroke into the address bar), but the clipboard contents are unaffected.

Also, in Firefox, one can:

  • select some text on a page (call this text "Text A")
  • switch to another program
  • copy some other text (call this text "Text B")
  • switch back to the page in Firefox
  • press Ctrl-F, which prefills Text A into the search box, just like VS Code (except that the text actually has to be selected, not just under the cursor)
  • paste from the clipboard into the search box, or paste it somewhere else
  • see that the pasted text is Text B

Behavior identical to that described above for Firefox can be observed in LibreOffice Writer 7.3.

I think it is reasonable to expect this behavior in VS Code, as this prevents the clipboard contents from being unintentionally overwritten. It is also the behavior of multiple other major applications.

Note

I originally came across a very similar issue in FreeTubeApp/FreeTube#2019 and FreeTubeApp/FreeTube#4282, which may be relevant. I decided to test the behavior of Visual Studio Code and found this problem in this program too.

I could apparently eliminate the issue there by focusing and selecting the text in the input element asynchronously, but I don't know enough about the much more complex vscode codebase right now so I don't feel like I could open a PR just yet.

@rebornix rebornix added editor-find Editor find operations under-discussion Issue is under discussion for relevance, priority, approach labels Nov 17, 2023
@amunger
Copy link
Contributor

amunger commented Dec 14, 2023

sounds like a duplicate of #130208

@amunger amunger closed this as not planned Won't fix, can't repro, duplicate, stale Dec 14, 2023
@sporeventexplosion
Copy link
Author

sporeventexplosion commented Dec 15, 2023

It seems in my testing that the CLIPBOARD buffer is overwritten. I did not check the contents of the PRIMARY buffer.

It's also a behavior specific to interactions with Klipper's clipboard sync functionality, so I think it's not a duplicate of #130208.

@amunger amunger reopened this Dec 15, 2023
@lvella
Copy link

lvella commented Apr 23, 2024

It seems to me the KDE option copies the contents of the PRIMARY buffer into the CLIPBOARD (probably vice-versa, too?) This propagates the problem of #167266 to the clipboard.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
editor-find Editor find operations under-discussion Issue is under discussion for relevance, priority, approach
Projects
None yet
Development

No branches or pull requests

4 participants