changeset 15791:465a58f2c711

fix extraneous char being added when gntentry's buffer grows fix crash when entering wide chars
author Richard Nelson <wabz@pidgin.im>
date Wed, 14 Mar 2007 07:56:48 +0000
parents d94d3d0f1149
children 9de8f4e810cb
files console/libgnt/gntentry.c console/libgnt/gntkeys.c
diffstat 2 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/console/libgnt/gntentry.c	Tue Mar 13 10:28:03 2007 +0000
+++ b/console/libgnt/gntentry.c	Wed Mar 14 07:56:48 2007 +0000
@@ -563,7 +563,7 @@
 				if (entry->end + len - entry->start >= entry->buffer)
 				{
 					/* This will cause the buffer to grow */
-					char *tmp = g_strdup_printf("%s%*s", entry->start, len, "");
+					char *tmp = g_strdup(entry->start);
 					gnt_entry_set_text_internal(entry, tmp);
 					g_free(tmp);
 				}
--- a/console/libgnt/gntkeys.c	Tue Mar 13 10:28:03 2007 +0000
+++ b/console/libgnt/gntkeys.c	Wed Mar 14 07:56:48 2007 +0000
@@ -121,6 +121,8 @@
 	struct _node *n = &root;
 
 	while (*path && n->next[*path] && !(n->flags & IS_END)) {
+		if (g_utf8_find_next_char(path, NULL) - path > 1)
+			return 0;
 		n = n->next[*path++];
 		depth++;
 	}