The problem is subtle. You want a way to clear the contents of a text field without selecting the contents first, because selecting them will clobber your selection buffer's contents. In my opinion, this is a design flaw in whatever UI toolkits are used on Linux. Only manually selected text should be copied to the X primary selection, not text that is selected incidentally as a result of a non-text-selecting operation (e.g. clicking in a text field). But anyway, how about a couple of workarounds?
If you don't mind adding extra toolbar buttons, you can try the pastego extension: But I'm not sure it works with the X selection.
Another option is to install one of the many extensions that add clear buttons to the location/search bars, such as Clear Fields, DiggiDig, ClearURLButton, or xclear. Then, you just hit the clear button, and the text field is empty, ready for you to middle-click your own text into it.
Lastly, you can try clickngo, which does more or less exactly what you want, and seems to work in FF 3.5, despite the lack of a recent version bump.
Edit: I just remembered a command-line solution to this problem: surfraw. Here's the beginning of the package description:
Surfraw provides a fast unix command line interface to a variety of
popular WWW search engines and other artifacts of power. It reclaims
google, altavista, dejanews, freshmeat, research index, slashdot
and many others from the false-prophet, pox-infested heathen lands of
html-forms, placing these wonders where they belong, deep in unix
heartland, as god loving extensions to the shell.
Basically, it lets to do google (and other) searches from the command line.
X Selections, Cut Buffers, and Kill Rings
Clipboard: for when the user has explicitly copied something (e.g., the ``Edit/Copy'' menu item.)
Primary: more ephemeral and implicit: it is for when the user has highlighted or selected something (e.g., dragging the mouse over some text.)
Cut Buffers: Obsolete. Never, ever, ever use them. Ever.
Secondary? Defined in ICCCCCCCM, but I haven't found a single program that uses it.
Wikipedia's article on X Window selection says that only cut buffers were window properties of the root window, named CUT_BUFFER1
and so on.
Best Answer
I mostly use KDE (when I can), where the default in terminal and in Ubuntu in general, is that selecting text means "copy" ("X selection" which is different from "clipboard copy"), which can then be pasted via middle mouse click.
If in your preferred graphical manager this does not happen automatically, you might try to use packages whose purpose is to synchronize the three clipboards of Linux.
Some packages that you may try for a more stable experience:
The packages may exist in your repository, or may be downloaded from the links for compilation and installation.
If middle mouse click does not work in your terminal, you might use another one. Or ask here how to enable it (if possible).