GNOME Bugzilla – Bug 319506
Paste and Go as in Opera
Last modified: 2016-03-29 18:26:09 UTC
Distribution/Version: Ubuntu 5.10 Opera has this feature that when you press CTRL-D, it performs the equivalent of these steps: * select all in location field (as if CTRL-L) * paste contents of clipboard (as if CTRL-V) * Go (as if Enter) For CTRL-SHIFT-D, it does this in a new tab in the background. Right-click on Location bar also allows this in Opera. Use cases: tons! * Everytime an URL isn't linked in a webpage * Everytime an URL isn't linked in a PDF, IM, Word processor... * Everytime one finds an URL in a plain text document * And: when I want to perform a search on some words in a page, from a chat or a document... Rationale: This is one of the most common operations there is for many users, depending of course on what sites or documents one usually read. So I think it deserves it's own shortcut (and context menu). It's a seemingly small feature, but one that may cause many small happinesses throughout a day. It's those small things that makes an application stand out as extra useful. If non-urls continue to default to search, this is extra useful, as it it eases search operations too, something that in at least my case is even more common. Middle click paste-and-go solves this problem for some, but for me and many others it feels very awkvard even though we've tried to get used to it. It's also not a feature I want enabled by default, I'm accidently middle-clicking as I scroll and that is *not* what I want happening. I expect the CTRL-C buffer to be used also, as do many who doesn't even know about PRIMARY clipboard. Potential shortcuts: * CTRL-V: when not focused in a text field. Might be surprising if user meant to paste into text field, and potentially destructive if contents is lost. * CTRL-SHIFT-L: "Accelerated CTRL-L". Feels natural. But what of open in background? * CTRL-SHIFT-V: same as L, though maybe not as natural. * CTRL-K: Next to CTRL-L, can be accelerated in turn with CTRL-SHIFT-K for open in tab. * Plenty more. :) Suggestion: * That a keyboard shortcut for this is implemented * A context menu entry for location bar that pastes and goes * A context menu entry for tabs that pastes and goes? * A context menu entry for selected text in a webpage that does this with the selected text (performs the copy first)
sounds reasonable to me. Accepting.
The middle mouse button can be configured to open the url on the clipboard, although I agree having a shortcut key for this would nice.
Wasn't this recently fixed in CVS?
Don't think so. We could make middle-click-paste use Ctrl to open in new tab (code in src/ephy-tab.c), that would make sense. Ctrl-D is used to bookmark the page, so I don't think we can adopt this...
> We could make middle-click-paste use Ctrl to open in new tab Only solves the problem for those who uses middle-click-paste to navigate, original bug report specifically mentions that this is not a good solution for me and others. > Ctrl-D is used to bookmark the page, so I don't think we can adopt this... Noone wants to adopt Operas weird non-HIG shortcuts, especially as that one doesn't make any sense. Paste and Go for Firefox uses CTRL+SHIFT+V, which does make sense and is among the suggestions listed in original bug report.
control+shift+v makes more sense. So it's the clipboard or the selection that gets pasted? For me at least, middle click on new tab button solves the problem, it opens a new tab with the content of my selection or clipboard. But I guess some people prefer the keyboard shortcut.
Created attachment 324048 [details] [review] location-entry: Add Paste & Go item in the context menu This patch adds a 'Paste & Go' context menu entry in the location entry.
Review of attachment 324048 [details] [review]: Excellent, been planning to do this for a while. ::: lib/widgets/ephy-location-entry.c @@ +592,3 @@ static void +clipboard_request_text_cb (GtkClipboard *clipboard, + const gchar *text, Watch the whitespace here: tab over as far as you can go with 8-space tabs, then use space characters the rest of the way to make the code line up. It's high time we got rid of these tabs. I'm playing with uncrustify configuration now, trying to get it right; after we release 3.18.0, maybe then I'll run it on all of these files before we branch. @@ +596,3 @@ +{ + gtk_entry_set_text (GTK_ENTRY (entry), text); + g_signal_emit_by_name (entry, "activate"); OK if this is what's used elsewhere in the file. Otherwise, I prefer to use g_signal_emit() in new code. @@ +601,3 @@ +static void +entry_paste_and_go_activate_cb (GtkMenuItem *item, + EphyLocationEntry *entry) Ditto @@ +607,3 @@ + clipboard = gtk_clipboard_get (GDK_SELECTION_CLIPBOARD); + gtk_clipboard_request_text (clipboard, + (GtkClipboardTextReceivedFunc) clipboard_request_text_cb, Ditto @@ +665,3 @@ + g_signal_connect (paste_and_go_menuitem, "activate", + G_CALLBACK (entry_paste_and_go_activate_cb), lentry); + gtk_widget_set_sensitive (paste_and_go_menuitem, TRUE); What if the clipboard is empty? You should find some way to check the sensitivity of the paste menu item, and make the sensitivity of paste and go match that.
Created attachment 324217 [details] [review] location-entry: Add 'Paste & Go' item to context menu > Watch the whitespace here: tab over as far as you can go with 8-space tabs, then use > space characters the rest of the way to make the code line up. My text editor wasn't configured properly, it should be fine now. > What if the clipboard is empty? You should find some way to check the sensitivity of > the paste menu item, and make the sensitivity of paste and go match that. A binding takes care of that now. Another thing I noticed is that even if I set my clipboard to an empty string, the 'Paste' option is still sensitive. Due to this, I'm only setting a new address in the location entry only when the text has some characters in it.
Review of attachment 324217 [details] [review]: ::: lib/widgets/ephy-location-entry.c @@ +597,3 @@ + EphyLocationEntry *entry) +{ + if (text) Good catch. @@ +683,3 @@ + g_signal_connect (paste_and_go_menuitem, "activate", + G_CALLBACK (entry_paste_and_go_activate_cb), lentry); + lentry->paste_binding = g_object_bind_property (paste_menuitem, "sensitive", Excellent
Attachment 324217 [details] pushed as b5668df - location-entry: Add 'Paste & Go' item to context menu