epiphany r8708 - trunk/lib/widgets



Author: gns
Date: Tue Jan 20 15:42:05 2009
New Revision: 8708
URL: http://svn.gnome.org/viewvc/epiphany?rev=8708&view=rev

Log:
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.

Modified:
   trunk/lib/widgets/ephy-location-entry.c

Modified: trunk/lib/widgets/ephy-location-entry.c
==============================================================================
--- trunk/lib/widgets/ephy-location-entry.c	(original)
+++ trunk/lib/widgets/ephy-location-entry.c	Tue Jan 20 15:42:05 2009
@@ -357,7 +357,7 @@
 		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 @@
 			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 @@
 				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;
 			}
 		}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]