Mercurial > pidgin
diff console/libgnt/gnttree.c @ 13936:669898e6aa11
[gaim-migrate @ 16467]
Minor enhancements for the combobox.
committer: Tailor Script <tailor@pidgin.im>
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Sun, 09 Jul 2006 00:54:31 +0000 |
parents | cd2da4b079cf |
children | af23525bcb31 |
line wrap: on
line diff
--- a/console/libgnt/gnttree.c Sat Jul 08 23:58:20 2006 +0000 +++ b/console/libgnt/gnttree.c Sun Jul 09 00:54:31 2006 +0000 @@ -201,11 +201,13 @@ g_snprintf(format, sizeof(format) - 1, "[%c] ", row->isselected ? 'X' : ' '); } - /* XXX: Need a utf8 version of snprintf */ - if ((wr = g_snprintf(str, widget->priv.width, "%s%s", format, row->text)) >= widget->priv.width) + g_snprintf(str, sizeof(str) - 1, "%s%s", format, row->text); + + if ((wr = g_utf8_strlen(str, -1)) >= widget->priv.width - 1 - pos) { /* XXX: ellipsize */ - str[widget->priv.width - 1 - pos] = 0; + char *s = g_utf8_offset_to_pointer(str, widget->priv.width - 1 - pos); + *s = '\0'; } else {