Use g_unichar_isspace for checking for space in tab completion

Fri, 03 Jan 2014 14:33:36 +0530

author
Ankit Vani <a@nevitus.org>
date
Fri, 03 Jan 2014 14:33:36 +0530
changeset 35132
beed96ae4a6b
parent 35131
6cf8a9b09ba1
child 35133
20123bcf5c56

Use g_unichar_isspace for checking for space in tab completion

pidgin/gtkconv.c file | annotate | diff | comparison | revisions
--- a/pidgin/gtkconv.c	Fri Jan 03 12:04:53 2014 +0530
+++ b/pidgin/gtkconv.c	Fri Jan 03 14:33:36 2014 +0530
@@ -4474,7 +4474,7 @@
 		ch2 = g_utf8_find_next_char(ch, NULL);
 	}
 
-	if (caret >= 2 && *ch == ':' && (*ch2 == ' ' || g_utf8_get_char(ch2) == 0xA0))
+	if (caret >= 2 && *ch == ':' && g_unichar_isspace(g_utf8_get_char(ch2)))
 		colon = 2;
 	else if (caret >= 1 && content[caret - 1] == ':')
 		colon = 1;
@@ -4485,7 +4485,7 @@
 	/* find the start of the word that we're tabbing. */
 	ch = g_utf8_offset_to_pointer(content, caret);
 	while ((ch = g_utf8_find_prev_char(content, ch))) {
-		if (*ch != ' ' && g_utf8_get_char(ch) != 0xA0)
+		if (!g_unichar_isspace(g_utf8_get_char(ch)))
 			--word_start;
 		else
 			break;
@@ -4575,9 +4575,9 @@
 			if (caret < content_len) {
 				tmp = g_strdup_printf("%s: ", (char *)matches->data);
 			} else {
-				char utf[6] = {0};
-				g_unichar_to_utf8(0xA0, utf);
-				tmp = g_strdup_printf("%s:%s", (char *)matches->data, utf);
+				char nbsp[6] = {0};
+				g_unichar_to_utf8(0xA0, nbsp);
+				tmp = g_strdup_printf("%s:%s", (char *)matches->data, nbsp);
 			}
 
 			modified = g_strdup_printf("%s%s", tmp, sub2);

mercurial