summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Kamil Kozar <dkk089@gmail.com>2017-09-19 20:19:47 +0200
committerDaniel Kamil Kozar <dkk089@gmail.com>2017-09-19 20:19:47 +0200
commit1b13b8cd2c16bfeafc5a69e8765d46eb2a5536a9 (patch)
tree7073c661fd060beb8422359d26256fba7d846307
parentaf29915c6a23a50b62f27bb3b82cb22c917992e6 (diff)
downloadpidgin-1b13b8cd2c16bfeafc5a69e8765d46eb2a5536a9.tar.gz
Improve smiley matching for unicode
This is an import of the patch provided in https://developer.pidgin.im/ticket/17232 , authored by gnubfx.
-rw-r--r--pidgin/gtkimhtml.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/pidgin/gtkimhtml.c b/pidgin/gtkimhtml.c
index 777db0bef4..ef55686c33 100644
--- a/pidgin/gtkimhtml.c
+++ b/pidgin/gtkimhtml.c
@@ -2054,9 +2054,10 @@ gtk_smiley_tree_lookup (GtkSmileyTree *tree,
{
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 @@ gtk_smiley_tree_lookup (GtkSmileyTree *tree,
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 @@ gtk_smiley_tree_lookup (GtkSmileyTree *tree,
if (t->image)
return len;
- return 0;
+ return lastlen;
}
static void