From 81ac0c59f3ce68053d83462577bae7e57c21cc36 Mon Sep 17 00:00:00 2001 From: "C. McEnroe" Date: Sun, 2 Feb 2020 20:23:36 -0500 Subject: [PATCH] Track unread and window heat --- ui.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/ui.c b/ui.c index 8bc3eae..b9aadec 100644 --- a/ui.c +++ b/ui.c @@ -324,7 +324,7 @@ static void statusUpdate(void) { idColors[window->id] ); if (!window->unread) buf[unread] = '\0'; - styleAdd(status, buf, true); + styleAdd(status, buf, false); } wclrtoeol(status); @@ -342,11 +342,11 @@ static void statusUpdate(void) { } void uiShowID(size_t id) { + windows.active->mark = true; struct Window *window = windowFor(id); window->heat = Cold; window->unread = 0; window->mark = false; - if (windows.active) windows.active->mark = true; windows.other = windows.active; windows.active = window; touchwin(window->pad); @@ -357,7 +357,14 @@ void uiWrite(size_t id, enum Heat heat, const struct tm *time, const char *str) (void)time; struct Window *window = windowFor(id); waddch(window->pad, '\n'); - styleAdd(window->pad, str, true); + if (window->mark && heat > Cold) { + if (!window->unread++) { + waddch(window->pad, '\n'); + } + window->heat = heat; + statusUpdate(); + } + styleAdd(window->pad, str, false); } void uiFormat(