https://bugs.winehq.org/show_bug.cgi?id=50536
Bug ID: 50536 Summary: Copy pasting from Notepad++ does not work consistently Product: Wine Version: unspecified Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: -unknown Assignee: wine-bugs@winehq.org Reporter: abuy@protonmail.com Distribution: ---
Created attachment 69198 --> https://bugs.winehq.org/attachment.cgi?id=69198 Screenrecording displaying bug behaviour.
## Bug description When I copy things in notepad++ v7.9.2 on Ubuntu 20.04 it does not consistently paste them (neither in notepad++ nor in other programs).
## Bug reproduction
1. At 0:03 I select the characters bc in notepad using the `shift+->Shift+->Ctrl+c 1. the clipboard now contains the characters `bv` 1. At 0:04 I switch to Gedit with alt tab (shown as cAlt+<- ->) 1. At 0:06 I copy paste the copied `bc` from clipboard with: Ctrl+v 1. At 0:07 I do two new lines and paste again and do a new line with: <-| <-| Ctrl+V <-| 1. At 0:09 I swith back to notepad++ with Alt tab (shown as cAlt+<- ->) and go down one line with the arrow keys 1. At 00:10 I select the fg characters left of the cursor with shift left arrow twice: Shift+<-+Shift+<- 1. At 00:10 I copy the selected `fg` characters with Ctrl+c 1. At 00:12 I switch back to gedit with Alt+tab and paste the clipboard content with Ctrl+c[![Display of unexpected behavior, last paste pastes `bc` instead of `fg`.][1]][1]
[1]: https://i.stack.imgur.com/G2rh8.gif
## Expected behaviour I would expect the characters `fg` to be pasted, but instead it pasts the old clipboard content consisting of characters `bc`.
## Analysis I have not found any consistency in this bug, sometimes I just have to press Ctrl+c a few times to make sure that it actually copies it, and other times it just won't copy the selection (after 10 presses).
Also, the bug only shows in notepad++ on Wine on Ubuntu 20.04, I did not notice it in any other programs. I think this also rules out hardware/keyboard error, as that would (most likely) not limit itself to Notepad++ only.
## Question Is there some setting that I should change in Ubuntu, Wine or Notepad++, or is this a (un)known bug?
https://bugs.winehq.org/show_bug.cgi?id=50536
Pau Coma Ramirez paucoma@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |paucoma@gmail.com
--- Comment #1 from Pau Coma Ramirez paucoma@gmail.com --- This is a Strange Bug, which I am experiencing too, although only when launched via the ubuntu launcher. I have documented my Behavior in Bug 50598. In my case launching the program directly from a terminal window normally works, its only when I use the launcher.
I have found that the following seems to have effect even when launching via the ubuntu launcher(i.e. .desktop shortcut). but I am not sure about its persistance.
----
Basically open a terminal window and within your defined prefix of wine for which you run notepad edit/add the registry key
[HKEY_LOCAL_MACHINE\Software\Wine\X11 Driver] "UsePrimarySelection"="1"
The following command should do the trick
``` WINEPREFIX=~/.wine32 wine reg add "HKLM\Software\Wine\X11 Driver" /v UsePrimarySelection /t REG_SZ /d 1 ```
Note: I am assuming that ~/.wine32 is the wine prefix your notepad++ runs in.
More documentation on that registry edit "hack" [here](https://askubuntu.com/a/1312004/258256) Although in my case it worked with HKLM, others have suggested HKCU. So, you may also want to add [HKEY_CURRENT_USER\Software\Wine\X11 Driver] "UsePrimarySelection"="1"
https://bugs.winehq.org/show_bug.cgi?id=50536
--- Comment #2 from Pau Coma Ramirez paucoma@gmail.com --- (In reply to Pau Coma Ramirez from comment #1)
This is a Strange Bug, which I am experiencing too, although only when launched via the ubuntu launcher. I have documented my Behavior in Bug 50598. In my case launching the program directly from a terminal window normally works, its only when I use the launcher.
I have found that the following seems to have effect even when launching via the ubuntu launcher(i.e. .desktop shortcut). but I am not sure about its persistance.
Basically open a terminal window and within your defined prefix of wine for which you run notepad edit/add the registry key
[HKEY_LOCAL_MACHINE\Software\Wine\X11 Driver] "UsePrimarySelection"="1"
The following command should do the trick
WINEPREFIX=~/.wine32 wine reg add "HKLM\Software\Wine\X11 Driver" /v UsePrimarySelection /t REG_SZ /d 1
Note: I am assuming that ~/.wine32 is the wine prefix your notepad++ runs in.
More documentation on that registry edit "hack" [here](https://askubuntu.com/a/1312004/258256) Although in my case it worked with HKLM, others have suggested HKCU. So, you may also want to add [HKEY_CURRENT_USER\Software\Wine\X11 Driver] "UsePrimarySelection"="1"
I was mistaken, it must have been coincidence with something else that HKLM registry modification did anything.
according to the code "HKLM\Software\Wine\X11 Driver" is not checked but HKCU is..
Basically it checks:
- "HKCU\Software\Wine\AppDefaults\app.exe\X11 Driver\UsePrimarySelection" + app.exe is the name of your executable file - "HKCU\Software\Wine\X11 Driver\UsePrimarySelection"
Values accepted as "True" #define IS_OPTION_TRUE(ch) \ ((ch) == 'y' || (ch) == 'Y' || (ch) == 't' || (ch) == 'T' || (ch) == '1')
More info in the function [ setup_options(void)](https://source.winehq.org/git/wine.git/blob/HEAD:/dlls/winex11.drv/x11drv_ma...)
https://bugs.winehq.org/show_bug.cgi?id=50536
--- Comment #3 from Pau Coma Ramirez paucoma@gmail.com --- I believe that this has to do with an instance of some other program in wine "blocking" the X11 Driver clipboard interface as I have managed to replicate this behaviour by opening a program where local clipboard works, but sharing across to X11 doesnt and keeping this one open and then opening notepad++ in the same wineprefix. Same thing happens, local clipboard ok, sharing across to x11 doesn't. I close the conflicting program and relaunch notepad++ and it works again.
In this case I have not added any registry key modification with respect to notepad++ so I doubt the registry key influences this behaviour.
I am uploading two logs with the following debug flags
`WINEDEBUG='+clipboard,+tid,+x11drv,fixme-all'`
Clipboard sharing OK --> 210204npppOK.log Clipboard sharing not OK, i.e. KO --> 210204npppKO.log
https://bugs.winehq.org/show_bug.cgi?id=50536
--- Comment #4 from Pau Coma Ramirez paucoma@gmail.com --- Created attachment 69304 --> https://bugs.winehq.org/attachment.cgi?id=69304 Functional Clipboard sharing log
`WINEDEBUG='+clipboard,+tid,+x11drv,fixme-all'`
Clipboard sharing OK --> 210204npppOK.log
https://bugs.winehq.org/show_bug.cgi?id=50536
--- Comment #5 from Pau Coma Ramirez paucoma@gmail.com --- Created attachment 69305 --> https://bugs.winehq.org/attachment.cgi?id=69305 Not Functional Clipboard sharing log
`WINEDEBUG='+clipboard,+tid,+x11drv,fixme-all'`
Clipboard sharing not OK, i.e. KO --> 210204npppKO.log