This is running under Sway, testing with Wayland native apps only (no xwayland).
When I first open a file in Geany, I can copy out of Geany and paste into another program by selecting and then middle clicking in the usual way. I can do that multiple times with different selections. If I then select something ("foo" for example) in the other program, I can middle click paste it into Geany. I can do this with multiple selections as well. All OK so far.
At this point if I select something in Geany ("bar" for example), I can no longer middle click paste it outside of Geany. I just get "foo" instead, even if I make sure to unselect "foo" in the other app before selecting "bar" in Geany. Middle click copy/paste within Geany works fine still. It also works fine within and between non-Geany applications. It is as if Geany is now using a different primary buffer than everything else.
Opening a new file in Geany (or closing and reopening an existing one) gets things working again temporarily.
I've tested this with Geany 1.36 and also the latest Master branch. I also tried applying the patch from here, but saw no difference: https://sourceforge.net/p/scintilla/bugs/2127/
I have mainly been using kitty (0.18.3) and firefox (78.3.0 esr) as the other applications. Sway is version 1.5-3. This is on Debian Bullseye. I also briefly tried to check if SciTe exhibits the same behavior, but middle click copy paste did not work at all there (at least to other programs, not sure if it worked within SciTe).
WFM selecting and middle pasting between here (in Chrome 86) and Geany 1.37 on Linux Mint 20.
Can you clarify if you are running Sway, and if not then Wayland or X11? I'm asking because surely this bug is Wayland related.
Sorry I wasn't clear, pointing out it works fine with X11 and Cinnamon, so as you say its likely something to do with Sway and its implementation of the Wayland protocols around clipboards (or the protocols themselves might be flakey, but then all WMs would have the bug).
Here middle click and paste works in Scite 4.3.0 (the one in the distros repo), thats a newer Scintilla than Geany 1.36/7 but IIRC there have not been any major changes to the GTK backend.
AFAIK none of the Geany devs use Wayland based systems or sway, so we can't give you much guidance, other contributors might.
If possible you could try a different WM, like Gnome and see if the problem still exists.
I can confirm this problem with Sway. Selected text can be only pasted within Geany. It doesn't even work with other Wayland native softwares, like Alacritty. A bug is already opened on Alacritty side : https://github.com/alacritty/alacritty/issues/3592
The same bug also applies with XWayland apps. For now, the only trick is to specify `GDK_BACKEND=x11` before launching Geany. Needless to say it is quite unpractical.
For now, the only trick is to specify GDK_BACKEND=x11 before launching Geany. Needless to say it is quite unpractical.
Would appear to be a problem with GTK then since GDK is its lower level portable layer.
I think this is a Scintilla issue https://sourceforge.net/p/scintilla/bugs/2227/.
Same issue for me in Debian testing. I saw that the Scintilla issue was fixed today. I just fear that it may be too late for the next Debian stable :-)
Since the change (won't say fix until performance is checked) was made to Scintilla 5 which is still unstable, and is not backward compatible with Scintilla 3 as currently used by Geany, the changes required make it _possible_ (but not guaranteed) that it will be in the long term stable after that (Bullseye was frozen last month IIUC so it won't make that, but it possibly will make the average year gap to the next stable opening) _if_ Scintilla 5 stabilised and then "somebody" contributes the Geany change to Version 5.
Would backporting to Scintilla 3 code an option?
I don't know what the fix was, or if it would backport, someone would have to try it.
Here's the fix: https://sourceforge.net/p/scintilla/code/ci/921cb3dea3112a
This is solved by https://github.com/geany/geany/pull/2867 It can be closed with the next release with this commit.
Can a sway user confirm its fixed with current Geany git?
Had the same issue on Gnome Wayland with Geany 1.38. I can confirm it's fixed in current git. Thanks!
ubuntu 22.04 gnome 42 wayland This issue comes again, write code is very hard without primary clipboard. I need geany.
@eexpress confirm you are using the latest Geany from git, not the version in Ubuntu?
OK, I try meson. But I remember it is hard to build.
Regarding the issue with loosing the selected text for paste on click, I had described a similar behavior here https://sourceforge.net/p/scintilla/bugs/2287/#df46/1070 where you can paste the selected text only once.
You might comment on the mentioned Scintilla bug report or open a new one to get the behavior changed.
I tried this change, and it seems to be enough to get at least basic functionality back: ```diff diff --git a/scintilla/gtk/ScintillaGTK.cxx b/scintilla/gtk/ScintillaGTK.cxx index d2780a959..72744b2b7 100644 --- a/scintilla/gtk/ScintillaGTK.cxx +++ b/scintilla/gtk/ScintillaGTK.cxx @@ -1501,8 +1501,8 @@ void ScintillaGTK::PrimaryClearSelection(GtkClipboard *clip, gpointer pSci) { void ScintillaGTK::ClaimSelection() { // X Windows has a 'primary selection' as well as the clipboard. // Whenever the user selects some text, we become the primary selection - ClearPrimarySelection(); if (!sel.Empty()) { + ClearPrimarySelection(); if (gtk_clipboard_set_with_data( gtk_clipboard_get(GDK_SELECTION_PRIMARY), clipboardCopyTargets, nClipboardCopyTargets, ```
The behavior seems similar to e.g. VTE.
The thing is that it's now trickier to clear the PRIMARY selection: you have to make another one and cancel that new one before pasting it. But at least we get back consecutive pasting.
@nyamatongwe would you potentially accept something like that, or did I miss glaring problems it could cause?
Unsure what the @b4n patch is addressing.
The initially reported issue here does not occur for me with Geany 2.0 on Ubuntu 24.10 with Wayland middle clicking to and from FireFox.
@nyamatongwe OK I see that the OP is actually a slightly different issue that I don't have either, I thought all of our issues were the same, sorry.
What my patch tries to address is the ability to middle-click paste from Scintilla to itself multiple times, e.g. not clear the PRIMARY selection upon pasting.
Committed with https://sourceforge.net/p/scintilla/code/ci/fac2fb49b0eecc9a628dfe1a720d319b...
I suspect this will move the issue a bit but there will still be people running into unexpected behaviour.
> The thing is that it's now trickier to clear the PRIMARY selection: you have to make another one and cancel that new one before pasting it. But at least we get back consecutive pasting.
Pardon my ignorance, but why would there be a *need* to clear the primary selection at all? Can't the selected text just stay there permanently until something else is selected?
By the way, these are fantastic news! Hope this Scintilla change gets merged into Geany soon.
(In any case, this might be more on topic on bug #3658 than this one)
github-comments@lists.geany.org