diff options
author | C. McEnroe | 2020-05-24 12:34:23 -0400 |
---|---|---|
committer | C. McEnroe | 2020-05-24 12:34:23 -0400 |
commit | 53f206f7e0a988cfc229a22ba0b929d7cdfcafff (patch) | |
tree | 9b7b0578155fee7e250f19a6733f00b5934adddb | |
parent | fd679bbca8ad24c0ddd69e3d2018fbbe4bb8e54d (diff) |
Tweak status line formatting
-rw-r--r-- | ui.c | 43 |
1 files changed, 24 insertions, 19 deletions
diff --git a/ui.c b/ui.c index 6fe7061..e91bd26 100644 --- a/ui.c +++ b/ui.c @@ -437,23 +437,28 @@ static void statusUpdate(void) { others.unread += window->unreadWarm; if (window->heat > others.heat) others.heat = window->heat; } - int truncUnread, truncScroll; - char buf[256]; - snprintf( - 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, (window->mute ? "=" : ""), (window->ignore ? "" : "-"), - idNames[window->id], - &truncUnread, (window->heat > Warm ? White : idColors[window->id]), - window->unreadWarm, - idColors[window->id], - &truncScroll, window->scroll + char buf[256] = ""; + catf( + buf, sizeof(buf), "\3%d%s %u ", + idColors[window->id], (num == windows.show ? "\26" : ""), num ); - if (!window->scroll) { - buf[truncScroll] = '\0'; - if (!window->mark || !window->unreadWarm) { - buf[truncUnread] = '\0'; - } + if (!window->ignore || window->mute) { + catf( + buf, sizeof(buf), "%s%s ", + &"-"[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); } @@ -463,14 +468,14 @@ static void statusUpdate(void) { snprintf(title, sizeof(title), "%s %s", network.name, idNames[window->id]); if (window->mark && window->unreadWarm) { catf( - title, sizeof(title), " (%d%s)", - window->unreadWarm, (window->heat > Warm ? "!" : "") + title, sizeof(title), " +%d%s", + window->unreadWarm, &"!"[window->heat < Hot] ); } if (others.unread) { catf( title, sizeof(title), " (+%d%s)", - others.unread, (others.heat > Warm ? "!" : "") + others.unread, &"!"[others.heat < Hot] ); } } |