aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGustavo Noronha Silva <gns@src.gnome.org>2009-01-20 23:46:46 +0800
committerGustavo Noronha Silva <gns@src.gnome.org>2009-01-20 23:46:46 +0800
commit5f799768c70a98847c91d575266392ed277eed40 (patch)
treef453ff72d3def6e9ef686ac111a1547b8919725d
parent608ec37bc1d4667d5b2b9d5008a3cd737328fa0e (diff)
downloadgsoc2013-epiphany-5f799768c70a98847c91d575266392ed277eed40.tar
gsoc2013-epiphany-5f799768c70a98847c91d575266392ed277eed40.tar.gz
gsoc2013-epiphany-5f799768c70a98847c91d575266392ed277eed40.tar.bz2
gsoc2013-epiphany-5f799768c70a98847c91d575266392ed277eed40.tar.lz
gsoc2013-epiphany-5f799768c70a98847c91d575266392ed277eed40.tar.xz
gsoc2013-epiphany-5f799768c70a98847c91d575266392ed277eed40.tar.zst
gsoc2013-epiphany-5f799768c70a98847c91d575266392ed277eed40.zip
Handle end of line correctly on location bar search
This change fixes the last character of the last search term being cut off by special casing the end of the line. svn path=/branches/gnome-2-26/; revision=8710
-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 3f4f58009..c4bdda179 100644
--- a/lib/widgets/ephy-location-entry.c
+++ b/lib/widgets/ephy-location-entry.c
@@ -389,7 +389,7 @@ editable_changed_cb (GtkEditable *editable,
char *term;
GRegex *term_regex;
GRegex *quote_regex;
- guint count;
+ gint count;
gboolean inside_quotes = FALSE;
quote_regex = g_regex_new ("\"", G_REGEX_OPTIMIZE,
@@ -420,6 +420,15 @@ editable_changed_cb (GtkEditable *editable,
if (((ptr[0] == ' ') && (!inside_quotes)) || ptr[1] == '\0')
{
/*
+ * We special-case the end of the line because
+ * we would otherwise not copy the last character
+ * of the search string, since the for loop will
+ * stop before that.
+ */
+ if (ptr[1] == '\0')
+ count++;
+
+ /*
* remove quotes, and quote any regex-sensitive
* characters
*/
@@ -434,7 +443,8 @@ editable_changed_cb (GtkEditable *editable,
priv->search_terms = g_slist_append (priv->search_terms, term_regex);
g_free (term);
- count = 0;
+ /* count will be incremented by the for loop */
+ count = -1;
current = ptr + 1;
}
}