? gtksourceview-1.1.92.tar.gz
? search.patch
? gtksourceview/.gtksourceiter.c.swp
? gtksourceview/language-specs/php.patch
Index: gtksourceview/gtksourceiter.c
===================================================================
RCS file: /cvs/gnome/gtksourceview/gtksourceview/gtksourceiter.c,v
retrieving revision 1.8
diff -u -p -r1.8 gtksourceiter.c
--- gtksourceview/gtksourceiter.c	24 Jan 2005 16:40:33 -0000	1.8
+++ gtksourceview/gtksourceiter.c	27 Feb 2005 18:09:24 -0000
@@ -39,15 +39,17 @@
 static const gchar *
 pointer_from_offset_skipping_decomp (const gchar *str, gint offset)
 {
-	gchar *normal;
+	gchar *casefold, *normal;
 	const gchar *p, *q;
 
 	p = str;
 	while (offset > 0)
 	{
 		q = g_utf8_next_char (p);
-		normal = g_utf8_normalize (p, q - p, G_NORMALIZE_ALL);
+		casefold = g_utf8_casefold (p, q - p);
+		normal = g_utf8_normalize (casefold, -1, G_NORMALIZE_ALL);
 		offset -= g_utf8_strlen (normal, -1);
+		g_free (casefold);
 		g_free (normal);
 		p = q;
 	}
@@ -63,6 +65,7 @@ g_utf8_strcasestr (const gchar *haystack
 	gchar *p;
 	gchar *casefold;
 	gchar *caseless_haystack;
+	gchar *caseless_needle;
 	gint i;
 
 	g_return_val_if_fail (haystack != NULL, NULL);
@@ -72,7 +75,11 @@ g_utf8_strcasestr (const gchar *haystack
 	caseless_haystack = g_utf8_normalize (casefold, -1, G_NORMALIZE_ALL);
 	g_free (casefold);
 
-	needle_len = g_utf8_strlen (needle, -1);
+	casefold = g_utf8_casefold (needle, -1);
+	caseless_needle = g_utf8_normalize (casefold, -1, G_NORMALIZE_ALL);
+	g_free (casefold);
+
+	needle_len = g_utf8_strlen (caseless_needle, -1);
 	haystack_len = g_utf8_strlen (caseless_haystack, -1);
 
 	if (needle_len == 0)
@@ -88,12 +95,12 @@ g_utf8_strcasestr (const gchar *haystack
 	}
 
 	p = (gchar*)caseless_haystack;
-	needle_len = strlen (needle);
+	needle_len = strlen (caseless_needle);
 	i = 0;
 
 	while (*p)
 	{
-		if ((strncmp (p, needle, needle_len) == 0))
+		if ((strncmp (p, caseless_needle, needle_len) == 0))
 		{
 			ret = pointer_from_offset_skipping_decomp (haystack, i);
 			goto finally_1;
@@ -105,6 +112,7 @@ g_utf8_strcasestr (const gchar *haystack
 
 finally_1:
 	g_free (caseless_haystack);
+	g_free (caseless_needle);
 
 	return ret;
 }
@@ -118,6 +126,7 @@ g_utf8_strrcasestr (const gchar *haystac
 	gchar *p;
 	gchar *casefold;
 	gchar *caseless_haystack;
+	gchar *caseless_needle;
 	gint i;
 
 	g_return_val_if_fail (haystack != NULL, NULL);
@@ -127,7 +136,11 @@ g_utf8_strrcasestr (const gchar *haystac
 	caseless_haystack = g_utf8_normalize (casefold, -1, G_NORMALIZE_ALL);
 	g_free (casefold);
 
-	needle_len = g_utf8_strlen (needle, -1);
+	casefold = g_utf8_casefold (needle, -1);
+	caseless_needle = g_utf8_normalize (casefold, -1, G_NORMALIZE_ALL);
+	g_free (casefold);
+
+	needle_len = g_utf8_strlen (caseless_needle, -1);
 	haystack_len = g_utf8_strlen (caseless_haystack, -1);
 
 	if (needle_len == 0)
@@ -144,11 +157,11 @@ g_utf8_strrcasestr (const gchar *haystac
 
 	i = haystack_len - needle_len;
 	p = g_utf8_offset_to_pointer (caseless_haystack, i);
-	needle_len = strlen (needle);
+	needle_len = strlen (caseless_needle);
 
 	while (p >= caseless_haystack)
 	{
-		if (strncmp (p, needle, needle_len) == 0)
+		if (strncmp (p, caseless_needle, needle_len) == 0)
 		{
 			ret = pointer_from_offset_skipping_decomp (haystack, i);
 			goto finally_1;
@@ -211,6 +224,7 @@ forward_chars_with_skipping (GtkTextIter
 			     gboolean     skip_decomp)
 {
 	gint i;
+	gchar *casefold;
 
 	g_return_if_fail (count >= 0);
 
@@ -238,9 +252,11 @@ forward_chars_with_skipping (GtkTextIter
 			gint buffer_len;
 
 			buffer_len = g_unichar_to_utf8 (gtk_text_iter_get_char (iter), buffer);
-			normal = g_utf8_normalize (buffer, buffer_len, G_NORMALIZE_ALL);
+			casefold = g_utf8_casefold (buffer, buffer_len);
+			normal = g_utf8_normalize (casefold, -1, G_NORMALIZE_ALL);
 			i -= (g_utf8_strlen (normal, -1) - 1);
 			g_free (normal);
+			g_free (casefold);
 		}
 
 		gtk_text_iter_forward_char (iter);
@@ -451,7 +467,7 @@ strbreakup (const char *string,
 	    gint        max_tokens)
 {
 	GSList *string_list = NULL, *slist;
-	gchar **str_array, *s, *casefold, *new_string;
+	gchar **str_array, *s, *new_string;
 	guint i, n = 1;
 
 	g_return_val_if_fail (string != NULL, NULL);
@@ -473,10 +489,6 @@ strbreakup (const char *string,
 			new_string = g_new (gchar, len + 1);
 			strncpy (new_string, string, len);
 			new_string[len] = 0;
-			casefold = g_utf8_casefold (new_string, -1);
-			g_free (new_string);
-			new_string = g_utf8_normalize (casefold, -1, G_NORMALIZE_ALL);
-			g_free (casefold);
 			string_list = g_slist_prepend (string_list, new_string);
 			n++;
 			string = s + delimiter_len;
@@ -487,10 +499,7 @@ strbreakup (const char *string,
 	if (*string)
 	{
 		n++;
-		casefold = g_utf8_casefold (string, -1);
-		new_string = g_utf8_normalize (casefold, -1, G_NORMALIZE_ALL);
-		g_free (casefold);
-		string_list = g_slist_prepend (string_list, new_string);
+		string_list = g_slist_prepend (string_list, g_strdup (string));
 	}
 
 	str_array = g_new (gchar*, n);
