jun7 / rox-filer

ROX file manager
24 stars 6 forks source link

Preserve clipboard after copy/paste #184

Closed JakeSFR closed 5 years ago

JakeSFR commented 5 years ago

It would be nice if the clipboard wasn't cleared after CTRL+C/CTRL+V, so pasting the same stuff into multiple target locations would be much easier.

I just tried and it seems to work fine for me:

diff -ur rox-filer-master_old/ROX-Filer/src/menu.c rox-filer-master_new/ROX-Filer/src/menu.c
--- rox-filer-master_old/ROX-Filer/src/menu.c   2018-10-16 14:08:09.000000000 +0200
+++ rox-filer-master_new/ROX-Filer/src/menu.c   2018-10-18 15:26:32.224191000 +0200
@@ -2380,10 +2380,13 @@
    if (error)
        delayed_error(_("Error getting file list: %s"), error);

+   gboolean is_cut = (!strcmp(*uri_list, "cut")) ? true : false;
+
    g_strfreev(uri_list);
    gtk_selection_data_free(selection);

-   gtk_clipboard_clear(clipboard);
+   if (is_cut)
+       gtk_clipboard_clear(clipboard);
 }

 static void file_op(gpointer data, FileOp action, GtkWidget *unused)

The above is just a lousy, proof-of-concept patch (there are too many things I'm not sure about), to show you exactly what I mean.

Anyway, if you like the idea and there are no contraindications that I'm not aware of, I'd appreciate implementing it.

jun7 commented 5 years ago

I like the idea. I will pull it.

JakeSFR commented 5 years ago

Thank you!

jun7 commented 5 years ago

PS. Is it OK that my task is waiting for your pull request?

JakeSFR commented 5 years ago

I'm not sure I understand: you want me to actually create a pull request for this? If so, is it really good enough as is?

jun7 commented 5 years ago

I'm not sure I understand: you want me to actually create a pull request for this?

Yes. Ah sorry I miss understood the last line.

If so, is it really good enough as is?

I thought you will fix it and not checked the code. Yes the is_cut is duplicated but only clear with the cut is good than before.

Hmm. Sorry I will implement it.

jun7 commented 5 years ago

Thank you for the reporting!

JakeSFR commented 5 years ago

Alright, thanks again!

I thought you will fix it and not checked the code.

Sorry, but I wasn't sure how to do it 100% properly. For instance, I didn't know if it's ok to clear the clipboard before freeing 'url_list' and 'selection'. Now I see, it's ok. :)

Cheers!