diff options
author | C. McEnroe | 2020-02-02 20:23:36 -0500 |
---|---|---|
committer | C. McEnroe | 2020-02-02 20:25:12 -0500 |
commit | 81ac0c59f3ce68053d83462577bae7e57c21cc36 (patch) | |
tree | 3a0b56bdd6ecec0a81b3bc1b757fecea521e8596 | |
parent | 5398a6ac9d31916ec1a399813032797988e308d2 (diff) |
Track unread and window heat
-rw-r--r-- | ui.c | 13 |
1 files 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( |