Mercurial > pidgin
diff console/libgnt/gnttree.c @ 14846:c7651586e27b
[gaim-migrate @ 17615]
Patch from Richard Nelson (wabz) to fix the blist-width, and do ellipsization in the trees.
committer: Tailor Script <tailor@pidgin.im>
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Sun, 29 Oct 2006 01:32:04 +0000 |
parents | 97977138cf29 |
children | 0387e8b1b8c2 |
line wrap: on
line diff
--- a/console/libgnt/gnttree.c Sun Oct 29 00:15:32 2006 +0000 +++ b/console/libgnt/gnttree.c Sun Oct 29 01:32:04 2006 +0000 @@ -200,6 +200,7 @@ const char *text; int len = gnt_util_onscreen_width(col->text, NULL); int fl = 0; + gboolean cut = FALSE; if (i == 0) { @@ -231,13 +232,20 @@ else g_string_append_c(string, '|'); - if (len > tree->columns[i].width) - { - len = tree->columns[i].width; + if (len > tree->columns[i].width) { + len = tree->columns[i].width - 1; + cut = TRUE; + } + text = gnt_util_onscreen_width_to_pointer(col->text, len - fl, NULL); + string = g_string_append_len(string, col->text, text - col->text); + if (cut) { /* ellipsis */ + if (gnt_ascii_only()) + g_string_append_c(string, '~'); + else + string = g_string_append(string, "\342\200\246"); + len++; } - text = gnt_util_onscreen_width_to_pointer(col->text, len - fl, NULL); - string = g_string_append_len(string, col->text, text - col->text); if (len < tree->columns[i].width && iter->next) g_string_append_printf(string, "%*s", tree->columns[i].width - len, ""); } @@ -339,7 +347,6 @@ if ((wr = gnt_util_onscreen_width(str, NULL)) > scrcol) { - /* XXX: ellipsize */ char *s = (char*)gnt_util_onscreen_width_to_pointer(str, scrcol, &wr); *s = '\0'; }