qulogic/pidgin

Improve smiley matching for unicode
release-2.x.y
2017-09-19, Daniel Kamil Kozar
d892542513bf
Parents b185e9184501
Children 270e7206ab9d
Improve smiley matching for unicode

This is an import of the patch provided in
https://developer.pidgin.im/ticket/17232 , authored by gnubfx.
--- 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