pidgin/gtkimhtml.c

branch
release-2.x.y
changeset 38809
d892542513bf
parent 38265
ee28d52fe2ca
child 38810
270e7206ab9d
--- a/pidgin/gtkimhtml.c	Mon Sep 18 22:10:58 2017 -0500
+++ b/pidgin/gtkimhtml.c	Tue Sep 19 20:19:47 2017 +0200
@@ -2054,9 +2054,10 @@
 {
 	GtkSmileyTree *t = tree;
 	const gchar *x = text;
-	gint len = 0;
 	const gchar *amp;
 	gint alen;
+	gint len = 0;
+	gint lastlen = 0;
 
 	while (*x) {
 		gchar *pos;
@@ -2091,9 +2092,11 @@
 			pos = strchr (t->values->str, *x);
 		}
 
-		if (pos)
+		if (pos) {
 			t = t->children [GPOINTER_TO_INT(pos) - GPOINTER_TO_INT(t->values->str)];
-		else
+			if (t->image)
+				lastlen = len + alen;
+		} else
 			break;
 
 		x += alen;
@@ -2103,7 +2106,7 @@
 	if (t->image)
 		return len;
 
-	return 0;
+	return lastlen;
 }
 
 static void

mercurial