aboutsummaryrefslogtreecommitdiffstats
path: root/lib/widgets/ephy-location-entry.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/widgets/ephy-location-entry.c')
-rw-r--r--lib/widgets/ephy-location-entry.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/widgets/ephy-location-entry.c b/lib/widgets/ephy-location-entry.c
index e6fde2889..57fb89485 100644
--- a/lib/widgets/ephy-location-entry.c
+++ b/lib/widgets/ephy-location-entry.c
@@ -140,6 +140,7 @@ ephy_location_entry_init (EphyLocationEntry *w)
w->priv = p;
p->last_action_target = NULL;
p->editing = FALSE;
+ p->before_completion = NULL;
ephy_location_entry_build (w);
@@ -169,6 +170,8 @@ ephy_location_entry_finalize_impl (GObject *o)
LOG ("EphyLocationEntry finalized")
+ g_free (p->before_completion);
+
g_free (p);
G_OBJECT_CLASS (gtk_hbox_class)->finalize (o);
}
@@ -245,6 +248,9 @@ ephy_location_entry_autocompletion_show_alternatives_to (EphyLocationEntry *w)
{
EphyLocationEntryPrivate *p = w->priv;
+ g_free (p->before_completion),
+ p->before_completion = gtk_editable_get_chars (GTK_EDITABLE(p->entry), 0, -1);
+
if (ephy_location_ignore_prefix (w)) return FALSE;
if (p->autocompletion)
@@ -378,11 +384,15 @@ ephy_location_entry_key_press_event_cb (GtkWidget *entry, GdkEventKey *event, Ep
case GDK_Right:
case GDK_Up:
case GDK_Down:
- case GDK_Escape:
case GDK_Page_Up:
case GDK_Page_Down:
ephy_location_entry_autocompletion_hide_alternatives (w);
return FALSE;
+ case GDK_Escape:
+ real_entry_set_location (w, p->before_completion);
+ gtk_editable_set_position (GTK_EDITABLE (p->entry), -1);
+ ephy_location_entry_autocompletion_hide_alternatives (w);
+ return FALSE;
default:
w->priv->editing = TRUE;
ephy_location_entry_autocompletion_unselect_alternatives (w);
@@ -468,7 +478,7 @@ ephy_location_entry_autocompletion_window_url_selected_cb (EphyAutocompletionWin
int action,
EphyLocationEntry *w)
{
- real_entry_set_location (w, target);
+ real_entry_set_location (w, action ? w->priv->before_completion : target);
}
void