Tweak status line formatting

master
C. McEnroe 2020-05-24 12:34:23 -04:00
parent fd679bbca8
commit 53f206f7e0
1 changed files with 24 additions and 19 deletions

43
ui.c
View File

@ -437,23 +437,28 @@ static void statusUpdate(void) {
others.unread += window->unreadWarm; others.unread += window->unreadWarm;
if (window->heat > others.heat) others.heat = window->heat; if (window->heat > others.heat) others.heat = window->heat;
} }
int truncUnread, truncScroll; char buf[256] = "";
char buf[256]; catf(
snprintf( buf, sizeof(buf), "\3%d%s %u ",
buf, sizeof(buf), "\3%d%s %u%s%s %s %n(\3%02d%d\3%d) %n[%d] ", idColors[window->id], (num == windows.show ? "\26" : ""), num
idColors[window->id], (num == windows.show ? "\26" : ""),
num, (window->mute ? "=" : ""), (window->ignore ? "" : "-"),
idNames[window->id],
&truncUnread, (window->heat > Warm ? White : idColors[window->id]),
window->unreadWarm,
idColors[window->id],
&truncScroll, window->scroll
); );
if (!window->scroll) { if (!window->ignore || window->mute) {
buf[truncScroll] = '\0'; catf(
if (!window->mark || !window->unreadWarm) { buf, sizeof(buf), "%s%s ",
buf[truncUnread] = '\0'; &"-"[window->ignore], &"="[!window->mute]
} );
}
catf(buf, sizeof(buf), "%s ", idNames[window->id]);
if (window->mark && window->unreadWarm) {
catf(
buf, sizeof(buf), "\3%d+%d\3%d%s",
(window->heat > Warm ? White : idColors[window->id]),
window->unreadWarm, idColors[window->id],
(window->scroll ? "" : " ")
);
}
if (window->scroll) {
catf(buf, sizeof(buf), "~%d ", window->scroll);
} }
statusAdd(buf); statusAdd(buf);
} }
@ -463,14 +468,14 @@ static void statusUpdate(void) {
snprintf(title, sizeof(title), "%s %s", network.name, idNames[window->id]); snprintf(title, sizeof(title), "%s %s", network.name, idNames[window->id]);
if (window->mark && window->unreadWarm) { if (window->mark && window->unreadWarm) {
catf( catf(
title, sizeof(title), " (%d%s)", title, sizeof(title), " +%d%s",
window->unreadWarm, (window->heat > Warm ? "!" : "") window->unreadWarm, &"!"[window->heat < Hot]
); );
} }
if (others.unread) { if (others.unread) {
catf( catf(
title, sizeof(title), " (+%d%s)", title, sizeof(title), " (+%d%s)",
others.unread, (others.heat > Warm ? "!" : "") others.unread, &"!"[others.heat < Hot]
); );
} }
} }