1
0
Fork 0
forked from murx/irc9

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

View file

@ -148,8 +148,9 @@ Build yours by copying `irc9rc-example` to `irc9rc` next to the binary (or to
The left column is a tree: each server and its windows (channels and private
message windows). Channels appear before private message windows, with
uppercase names sorting before lowercase names in each group. An unread window shows `(n)` next to its name. `*` marks a
connected server. The selected server or window is shown bold and underlined. Highlights use the
uppercase names sorting before lowercase names in each group. An unread window
shows `(n)` next to its name. Each server shows its total unread count after
its name, including when folded. `*` marks a connected server. The selected server or window is shown bold and underlined. Highlights use the
terminal's default background so transparency is preserved where supported.
Channel topics wrap to the chat pane width and stay at the top while you scroll.
On short terminals, the topic leaves room for at least one chat line when possible.

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;