! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
auto-selecting text in Find dialog overwrites the PRIMARY selection (clipboard)
Status:
RESOLVED: FIXED
Product:
Xfce4-terminal
Component:
General

Comments

Description inactive 2020-04-16 14:14:39 CEST
I usually select some text from a terminal, ready to have to pasted via pressing MMB(middle mouse button) into the Find dialog's "Search for" field, and then I go to another terminal, press Ctrl+Shift+F to open Find dialog and the previously searched text there is already pre-selected (eg. Select All) automatically which also clears my PRIMARY selection, thus pressing MMB will just paste the contents of what it selected instead of what I've already had in my PRIMARY selection before opening the Find dialog.

In other words, if I've every searched for something before, re-opening Find dialog will copy the text from "Search for" into my PRIMARY selection, so now I can paste it via MMB for example, but that also means it overwrites whatever else I've had ready to paste into "Search for" before opening Find dialog, which is a bummer :)

I can't really find out where the code that does this is, or else I would've patched it locally and not bother you with bug reports.
Any pointers?

Thanks.

Some info for future me:
What is PRIMARY selection: https://unix.stackexchange.com/questions/139191/whats-the-difference-between-primary-selection-and-clipboard-buffer#139193
Comment 1 inactive 2020-04-16 21:45:49 CEST
oh, it must be a gtk3 feauture, because I've just seen it happen somewhere else.
it must be happening when the default element(or what) is selected, when a dialog appears.

I saw it happen in Session and Startup -> on a program click Edit button, the 'Edit application' window/dialog pops up with 'Name:' input field auto-selected and thus overwrote my PRIMARY selection
Comment 2 inactive 2020-04-18 01:58:16 CEST
this is gtk3, it simply selects all text when grab focus is used, and it so happens that selecting text (maybe just for me?!) automatically overwrites PRIMARY selection(seems like it's working as it should, by the name).
Anyway I patched gtk3 to not select text of focused entry, thus keeping my previous selection in PRIMARY selection: https://bugzilla.xfce.org/show_bug.cgi?id=14814#c5

Technically there's something xfce4-terminal can do to "fix" this like that, but I'm pretty sure this isn't a wanted feature:
there's a gtk property that presumably can be set to false on the entry, since it's set to true by default, but I don't know how to use it(I don't know how to gtk)

here's from gtk source code( gtk/gtksettings.c) where I already set it to FALSE just to be safe(for my own uses):

  result = settings_install_property_parser (class,
            g_param_spec_boolean ("gtk-entry-select-on-focus",
                        P_("Select on focus"),
                        P_("Whether to select the contents of an entry when it is focused  "),
                              //TRUE, //overwrites PRIMARY selection ie. Ctrl+F opens Find dialog and you lose what you had previously selected!
                              FALSE, // so let's not select by default, unless the app specifically overrides it!                                                                                                                  
                              GTK_PARAM_READWRITE),
                              NULL);
    g_assert (result == PROP_ENTRY_SELECT_ON_FOCUS);
Comment 3 Git Bot editbugs 2020-04-19 00:25:53 CEST
Igor referenced this bugreport in commit 734dbe386b4aa24a2d952cb3c29bd22612c597e1

Do not select text in Search dialog

https://git.xfce.org/apps/xfce4-terminal/commit?id=734dbe386b4aa24a2d952cb3c29bd22612c597e1
Comment 4 Igor editbugs 2020-04-19 00:27:32 CEST
Thanks for the report!

While overwriting PRIMARY buffer with selected text is proper behavior, I've fixed the issue by preventing auto selecting text in the search dialog.

Bug #16701

Reported by:
inactive
Reported on: 2020-04-16
Last modified on: 2020-04-19

People

CC List:
1 user

Version

Version:
0.8.9.2

Attachments

Additional information