aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog8
-rw-r--r--lib/widgets/ephy-location-entry.c37
2 files changed, 44 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index bb239f7ae..65bbb1af3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
2004-02-11 Marco Pesenti Gritti <marco@gnome.org>
+ * lib/widgets/ephy-location-entry.c: (keyword_match),
+ (completion_func):
+
+ Better keyword matching function. Should match only words
+ (not middle parts of them) and maybe be a bit faster.
+
+2004-02-11 Marco Pesenti Gritti <marco@gnome.org>
+
* lib/ephy-node.c: (callback), (child_changed),
(ephy_node_set_property):
diff --git a/lib/widgets/ephy-location-entry.c b/lib/widgets/ephy-location-entry.c
index 36b1b4d8c..cee04febb 100644
--- a/lib/widgets/ephy-location-entry.c
+++ b/lib/widgets/ephy-location-entry.c
@@ -193,6 +193,41 @@ entry_button_press_cb (GtkWidget *entry, GdkEventButton *event, EphyLocationEntr
}
static gboolean
+keyword_match (const char *list,
+ const char *keyword)
+{
+ const char *p;
+ gsize keyword_len;
+
+ p = list;
+ keyword_len = strlen (keyword);
+
+ while (*p)
+ {
+ int i;
+
+ for (i = 0; i < keyword_len; i++)
+ {
+ if (p[i] == ' ')
+ goto next_char;
+
+ if (p[i] != keyword[i])
+ goto next_token;
+ }
+
+ return TRUE;
+
+ next_token:
+ while (*p != ' ') p++;
+
+ next_char:
+ if (*p) p++;
+ }
+
+ return FALSE;
+}
+
+static gboolean
completion_func (GtkEntryCompletion *completion,
const char *key,
GtkTreeIter *iter,
@@ -216,7 +251,7 @@ completion_func (GtkEntryCompletion *completion,
{
ret = TRUE;
}
- else if (strstr (keywords, key))
+ else if (keyword_match (keywords, key))
{
ret = TRUE;
}