aboutsummaryrefslogtreecommitdiffstats
path: root/lib/widgets
diff options
context:
space:
mode:
authorGustavo Noronha Silva <gns@src.gnome.org>2009-01-20 23:42:05 +0800
committerGustavo Noronha Silva <gns@src.gnome.org>2009-01-20 23:42:05 +0800
commitb6714cc33b570c46f4beb35710b5240eebdf4aa0 (patch)
treec609a1d8034682204edc5d3f35938fb2ccae1c90 /lib/widgets
parent204e4d53d1f29b4ed4c2b66ff16634aa9dbe25a4 (diff)
downloadgsoc2013-epiphany-b6714cc33b570c46f4beb35710b5240eebdf4aa0.tar
gsoc2013-epiphany-b6714cc33b570c46f4beb35710b5240eebdf4aa0.tar.gz
gsoc2013-epiphany-b6714cc33b570c46f4beb35710b5240eebdf4aa0.tar.bz2
gsoc2013-epiphany-b6714cc33b570c46f4beb35710b5240eebdf4aa0.tar.lz
gsoc2013-epiphany-b6714cc33b570c46f4beb35710b5240eebdf4aa0.tar.xz
gsoc2013-epiphany-b6714cc33b570c46f4beb35710b5240eebdf4aa0.tar.zst
gsoc2013-epiphany-b6714cc33b570c46f4beb35710b5240eebdf4aa0.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=/trunk/; revision=8708
Diffstat (limited to 'lib/widgets')
-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 fae13d5fe..ff84fa3fe 100644
--- a/lib/widgets/ephy-location-entry.c
+++ b/lib/widgets/ephy-location-entry.c
@@ -357,7 +357,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,
@@ -388,6 +388,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
*/
@@ -402,7 +411,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;
}
}