f56ed6265840b36283f3613fcb1a47915b370491
diff --git a/lib/widgets/ephy-location-entry.c b/lib/widgets/ephy-location-entry.c
index 18d123d..af19a87 100644
--- a/lib/widgets/ephy-location-entry.c
+++ b/lib/widgets/ephy-location-entry.c
@@ -94,6 +94,12 @@ static void extracell_data_func (GtkCellLayout *cell_layout,
 				GtkTreeIter *iter,
 				gpointer data);
 
+static void textcell_data_func (GtkCellLayout *cell_layout,
+			GtkCellRenderer *cell,
+			GtkTreeModel *tree_model,
+			GtkTreeIter *iter,
+			gpointer data);
+
 enum signalsEnum
 {
 	USER_CHANGED,
@@ -911,8 +917,13 @@ cursor_on_match_cb  (GtkEntryCompletion *completion,
 			    &item, -1);
 	entry = gtk_entry_completion_get_entry (completion);
 
+	/* Prevent the update so we keep the highlight from our input.
+	 * See textcell_data_func().
+	 */
+	le->priv->block_update = TRUE;
 	gtk_entry_set_text (GTK_ENTRY (entry), item);
 	gtk_editable_set_position (GTK_EDITABLE (entry), -1);
+	le->priv->block_update = FALSE;
 
 	g_free (item);
 
@@ -948,6 +959,52 @@ extracell_data_func (GtkCellLayout *cell_layout,
 	g_value_unset (&visible);
 }
 
+static void
+textcell_data_func (GtkCellLayout *cell_layout,
+			GtkCellRenderer *cell,
+			GtkTreeModel *tree_model,
+			GtkTreeIter *iter,
+			gpointer data)
+{
+	EphyLocationEntryPrivate *priv;
+	PangoAttrList *list;
+	PangoAttribute *att;
+	GMatchInfo *match;
+	int start, end;
+	GValue text = { 0, };
+
+	priv = EPHY_LOCATION_ENTRY (data)->priv;
+
+	gtk_tree_model_get_value (tree_model, iter, priv->text_col, &text);
+
+	list = pango_attr_list_new ();
+
+	g_regex_match (priv->regex,
+			g_value_get_string (&text),
+			G_REGEX_MATCH_NOTEMPTY, &match);
+
+	g_object_set_property (G_OBJECT (cell), "text", &text);
+	g_value_unset (&text);
+
+	while (g_match_info_matches (match)) {
+		g_match_info_fetch_pos (match, 0, &start, &end);
+
+		att = pango_attr_weight_new (PANGO_WEIGHT_BOLD);
+		att->start_index = start;
+		att->end_index = end;
+
+		pango_attr_list_insert (list, att);
+		g_match_info_next (match, NULL);
+	}
+
+	g_object_set (cell,
+			"attributes", list,
+			NULL);
+
+	pango_attr_list_unref (list);
+	g_match_info_free (match);
+}
+
 /**
  * ephy_location_entry_set_match_func:
  * @entry: an #EphyLocationEntry widget
@@ -1044,8 +1101,6 @@ ephy_location_entry_set_completion (EphyLocationEntry *entry,
 		      NULL);
 	gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (completion),
 				    cell, TRUE);
-	gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (completion),
-				       cell, "text", text_col);
 
 	entry->priv->extracell = gtk_cell_renderer_text_new ();
 	g_object_set (entry->priv->extracell,
@@ -1062,6 +1117,11 @@ ephy_location_entry_set_completion (EphyLocationEntry *entry,
 					entry,
 					NULL);
 
+	gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (completion),
+					cell, textcell_data_func,
+					entry,
+					NULL);
+
 	g_object_set (completion, "inline-selection", TRUE, NULL);
 	g_signal_connect (completion, "cursor-on-match",
 			  G_CALLBACK (cursor_on_match_cb), entry);
