[yelp] libyelp/yelp-location-entry: Use \W regexp to split search string
- From: Shaun McCance <shaunm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [yelp] libyelp/yelp-location-entry: Use \W regexp to split search string
- Date: Thu, 7 Apr 2011 12:41:30 +0000 (UTC)
commit b9e99bac67ca370afba2f67c75df47286462d813
Author: Shaun McCance <shaunm gnome org>
Date: Thu Apr 7 08:45:46 2011 -0400
libyelp/yelp-location-entry: Use \W regexp to split search string
I was annoyed that "middle-click" didn't match "middle click".
libyelp/yelp-location-entry.c | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/libyelp/yelp-location-entry.c b/libyelp/yelp-location-entry.c
index 55225d7..774af38 100644
--- a/libyelp/yelp-location-entry.c
+++ b/libyelp/yelp-location-entry.c
@@ -1191,6 +1191,12 @@ entry_match_func (GtkEntryCompletion *completion,
gchar **strs;
GtkTreeModel *model = gtk_entry_completion_get_model (completion);
YelpLocationEntryPrivate *priv = GET_PRIV (entry);
+ static GRegex *nonword = NULL;
+
+ if (nonword == NULL)
+ nonword = g_regex_new ("\\W", 0, 0, NULL);
+ if (nonword == NULL)
+ return FALSE;
gtk_tree_model_get (model, iter,
HISTORY_COL_TITLE, &title,
@@ -1205,7 +1211,7 @@ entry_match_func (GtkEntryCompletion *completion,
g_free (desc);
}
- strs = g_strsplit (key, " ", -1);
+ strs = g_regex_split (nonword, key, 0);
ret = TRUE;
for (stri = 0; strs[stri]; stri++) {
if (!titlecase || !strstr (titlecase, strs[stri])) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]