GNOME Bugzilla – Bug 345934
URL dropdown not compatible with ctrl-enter
Last modified: 2006-07-20 10:26:13 UTC
When you start typing a URL you get the URL dropdown that shows matching history. Often, I find myself wanting to open an old URL in a new tab, which I can do by hitting ctrl-enter while the URL is in the entry field. However, I've gotten used to only partially typing the URL, selecting the URL in the dropdown with the arrow keys, and then hitting ctrl-enter. That'll look like this text-screenshot ;) URL: http://example.com/par < entry field |http://example.com/partial | |http://example.com/partial/12345 | < selected line | ... | Now when I have selected the 12345 entry and hit ctrl-enter I would expect it to open the 12345 entry in a new tab (I think galeon does this and that's why I'm used to it), but it actually opens just the 'par' entry that I typed. Other information:
The same, btw, happens if you select a different search from the list (one of the smart bookmarks).
Created attachment 68605 [details] [review] patch almost fixing this problem This patch makes it behave like I'd expect, open a new tab with whatever I had selected. Actually, I probably expect it to jump to the new tab too, and the reset code doesn't seem to work properly (it resets, but then displays the other thing again once you switch tabs and back).
Heh + if (ephy_link_flags_from_current_event () + | (EPHY_LINK_NEW_WINDOW|EPHY_LINK_NEW_TAB)) should of course be + if (ephy_link_flags_from_current_event () + & (EPHY_LINK_NEW_WINDOW|EPHY_LINK_NEW_TAB)) But I haven't built it yet to see if it helps.
Created attachment 68620 [details] [review] patch fixing it for me This patch seems to work properly including resetting the typed URL on a tab and having it correct when you switch back and forth. I'd like to actually activate the tab right away though, but this is a more intrusive change I think.
patch also applies against current CVS with some offset.
So it seems that ctrl-enter does indeed put the selected text in the entry... so I think just moving the keypress handler from g_signal_connect to g_signal_connect_after should also work and be a simpler patch?
But will that also work with completion actions (as in the different search types) you can have there?
At least in testentrycompletion Ctrl-Enter does activate the action, yes. You'll need to add the flags in src/ephy-location-entry.c:action_activated_cb of course.
I guess I just have to try this (not familiar with gtk at all), but it seems to me that moving it to g_signal_connect_after would sort of defeat the point of the keypress handler because its return value is important in that it returns TRUE and stops the event from propagating further if the user had pressed ctrl (+shift), which means that we don't need to reset. But then, if I move it to _after, the event will again propagate through so that I'd still have to do the reset stuff, just in a different place. Ah, I guess I see what you mean -- I can then put the reset into the keypress handler... But that'll only work if g_signal_emit_by_name actually calls the handlers right away instead of queuing them up (I assume it does, will play with it tomorrow)
Created attachment 68689 [details] [review] another patch Well, I quickly played with it. This makes it almost work, but the typed_address remains set to whatever I enter, and isn't reset by opening a new window/tab. And I have no idea how to reset the typed address from the location-entry code (I'd have to trigger a user-changed signal but from the entry, not the lentry, and with the right action. I think.)
Hmm I see the problem... the 'reset' comes before the 'activate' in this case so it's useless. You could try ephy_location_entry_reset from ephy-location-action's activate/action_activate callbacks.
Ah, but then I have the same problem as in the first patch, that I need a reference to the location-entry and don't have one, so again I'd need to pass a pointer around. Or am I missing something?
Created attachment 68719 [details] [review] patch This was a bit more involved than I'd thought... Can you test this patch please?
Created attachment 68729 [details] [review] updated patch Also fixes middle-click.
Committed to HEAD and gnome-2-14. Can you verify it fixes all cases? Thanks for the initial patch!
No, that doesn't fix it completely. Try it: * enter anything and select any action * press ctrl-enter * go to the new tab * go back to the old tab note that whatever you entered is in the location entry instead of the URL of the page.
Right, that's a problem with ephy_location_entry_reset which also occurs when you just reset with ESC...
Created attachment 68834 [details] [review] additional patch This should fix the remaining problem.
Created attachment 68835 [details] [review] only the relevant parts
*** Bug 314754 has been marked as a duplicate of this bug. ***
*** Bug 328293 has been marked as a duplicate of this bug. ***
Good point, I never noticed it also happens when you press just ESC. But with these two patches, it works perfectly, thank you!
Checked in. Thanks for the bug report, the patches and the testing!