diff console/libgnt/gnttree.c @ 13851:41753203a94d

[gaim-migrate @ 16310] The colors should now look 'better' in terminals that don't apparently allow changing colors. committer: Tailor Script <tailor@pidgin.im>
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Thu, 22 Jun 2006 22:38:03 +0000
parents 0e1e59770cb0
children bbf0470cb348
line wrap: on
line diff
--- a/console/libgnt/gnttree.c	Thu Jun 22 08:33:54 2006 +0000
+++ b/console/libgnt/gnttree.c	Thu Jun 22 22:38:03 2006 +0000
@@ -47,14 +47,17 @@
 
 	wbkgd(tree->scroll, COLOR_PAIR(GNT_COLOR_NORMAL));
 
-	/* XXX: Add the rows */
 	for (start = tree->top, iter = g_list_nth(tree->list, tree->top);
 				iter && start < tree->bottom; start++, iter = iter->next)
 	{
 		char str[2096];	/* XXX: This should be safe for any terminal */
 		GntTreeRow *row = g_hash_table_lookup(tree->hash, iter->data);
 
-		snprintf(str, widget->priv.width - 2, "%s\n", row->text);
+		if (snprintf(str, widget->priv.width, "%s\n", row->text) >= widget->priv.width)
+		{
+			/* XXX: ellipsize */
+			str[widget->priv.width - 1] = 0;
+		}
 		
 		if (start == tree->current)
 		{
@@ -83,7 +86,7 @@
 
 	/* For the Tree (or anything that scrolls), we will create a 'hidden' window
 	 * of 'large enough' size. We never wrefresh that hidden-window, instead we
-	 * just 'scroll' it, and wrefresh the subwindow */
+	 * just copy stuff from it into the visible window */
 
 	if (tree->scroll == NULL)
 	{