Show total unread counts on server rows

This commit is contained in:
Johannes Findeisen 2026-12-02 00:41:02 +01:00
commit 375a6b3e32
2 changed files with 12 additions and 3 deletions

10
irc9.c
View file

@ -2782,7 +2782,15 @@ static void draw_tree(void)
fputs(w == curwin ? (terminal_color ? "\033[1;4m" : "\033[7m") : "\033[1m", stdout);
putchar(s->connected ? '*' : ' ');
if (s->tree_folded) putchar('+');
terminal_text(s->name ? s->name : s->host, treew - 3 - s->tree_folded);
long long unread = 0;
for (Window *child = s->windows; child; child = child->next)
unread += child->unread;
int columns = treew - 3 - s->tree_folded;
char count[32] = "";
int count_width = unread ? snprintf(count, sizeof count, " (%lld)", unread) : 0;
if (count_width > columns) count_width = 0;
terminal_text(s->name ? s->name : s->host, columns - count_width);
if (count_width) fputs(count, stdout);
fputs("\033[0m", stdout);
}
continue;