about summary refs log tree commit diff
path: root/ui.c
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-02-02 20:23:36 -0500
committerJune McEnroe <june@causal.agency>2020-02-02 20:25:12 -0500
commit81ac0c59f3ce68053d83462577bae7e57c21cc36 (patch)
tree3a0b56bdd6ecec0a81b3bc1b757fecea521e8596 /ui.c
parentRearrange some UI code (diff)
downloadcatgirl-81ac0c59f3ce68053d83462577bae7e57c21cc36.tar.gz
catgirl-81ac0c59f3ce68053d83462577bae7e57c21cc36.zip
Track unread and window heat
Diffstat (limited to 'ui.c')
-rw-r--r--ui.c13
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(