I really like the Linux-style copy paste (highlight text to copy, middle-click to paste) - except when text is automatically highlighted in a dialog box. For instance, selecting text on a web page that I'd like to paste as a file name, when choosing "Save Image" from Firefox or Chrome, the "Save As" dialog box now has the original file name highlighted which overwrites my original "copied" text. The same issue occurs when tabbing between text fields or highlighting the URL bar. Is there a trick to get around this or prevent automatically selected text from being put in the copy buffer, or reverting to the previously selected text once the new selection is deleted/unselected?
2 Answers
Save As
, Save Image As
, Save Page As
etc are (gtk+
) file-chooser dialogs. The file name that appears in the Save...
dialog is hard-coded via gtk_file_chooser_set_current_name ()
and usually defaults to the original file name unless you edit a new document, e.g. :
if (user_edited_a_new_document)
gtk_file_chooser_set_current_name (chooser,
_("Untitled document"));
else
gtk_file_chooser_set_filename (chooser,
existing_filename);
Since the file name is by default "highlighted" (read "selected"), your original (primary) selection is overwritten. The easiest way to go around this is to use CTRL+C and CTRL+V.
You have two 'clipboards' in Linux.
The first is the one of which you speak, where you select text and it is pasted via SHIFTINSERT or Middle-Mouse. This clipboard/buffer is very fickle and changes constantly. Be careful using this, especially with chat clients, because one day you'll paste your password into IRC.
The second is the standard CTRLC and CTRLV, or selecting Copy or Paste from a menu. This clipboard/buffer is not overwritten by the previous and should be used as a more trusted clipboard.
My recommendation is to utilize the second version of the clipboard more often.
-
I've been using the Ctrl-C Ctrl-V as you suggested, was just hoping someone had a way to make the middle-click clipboard work a little better within GUI applications that auto-select text. If no one else has a better solution I'll mark this as accepted.– baochanDec 2, 2014 at 19:24