Track unread and window heat

master
C. McEnroe 2020-02-02 20:23:36 -05:00
parent 5398a6ac9d
commit 81ac0c59f3
1 changed files with 10 additions and 3 deletions

13
ui.c
View File

@ -324,7 +324,7 @@ static void statusUpdate(void) {
idColors[window->id] idColors[window->id]
); );
if (!window->unread) buf[unread] = '\0'; if (!window->unread) buf[unread] = '\0';
styleAdd(status, buf, true); styleAdd(status, buf, false);
} }
wclrtoeol(status); wclrtoeol(status);
@ -342,11 +342,11 @@ static void statusUpdate(void) {
} }
void uiShowID(size_t id) { void uiShowID(size_t id) {
windows.active->mark = true;
struct Window *window = windowFor(id); struct Window *window = windowFor(id);
window->heat = Cold; window->heat = Cold;
window->unread = 0; window->unread = 0;
window->mark = false; window->mark = false;
if (windows.active) windows.active->mark = true;
windows.other = windows.active; windows.other = windows.active;
windows.active = window; windows.active = window;
touchwin(window->pad); touchwin(window->pad);
@ -357,7 +357,14 @@ void uiWrite(size_t id, enum Heat heat, const struct tm *time, const char *str)
(void)time; (void)time;
struct Window *window = windowFor(id); struct Window *window = windowFor(id);
waddch(window->pad, '\n'); 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( void uiFormat(