Show total unread counts on server rows
This commit is contained in:
parent
b488fdad57
commit
375a6b3e32
2 changed files with 12 additions and 3 deletions
|
|
@ -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
|
The left column is a tree: each server and its windows (channels and private
|
||||||
message windows). Channels appear before private message windows, with
|
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
|
uppercase names sorting before lowercase names in each group. An unread window
|
||||||
connected server. The selected server or window is shown bold and underlined. Highlights use the
|
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.
|
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.
|
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.
|
On short terminals, the topic leaves room for at least one chat line when possible.
|
||||||
|
|
|
||||||
10
irc9.c
10
irc9.c
|
|
@ -2782,7 +2782,15 @@ static void draw_tree(void)
|
||||||
fputs(w == curwin ? (terminal_color ? "\033[1;4m" : "\033[7m") : "\033[1m", stdout);
|
fputs(w == curwin ? (terminal_color ? "\033[1;4m" : "\033[7m") : "\033[1m", stdout);
|
||||||
putchar(s->connected ? '*' : ' ');
|
putchar(s->connected ? '*' : ' ');
|
||||||
if (s->tree_folded) putchar('+');
|
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);
|
fputs("\033[0m", stdout);
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue