summary refs log tree commit diff
path: root/ui.c
diff options
context:
space:
mode:
authorC. McEnroe2020-09-02 21:29:03 -0400
committerC. McEnroe2020-09-02 21:29:03 -0400
commit0968a8ac7c5342978fced88af6a897d9b5cdc6ab (patch)
tree857ccfd468b6b25d89f171f811060d4d0e1af4c0 /ui.c
parenta46fbea0ec38a153c07a06ea0177b136db3e3ecf (diff)
Recalculate unreadHard on reflow
Diffstat (limited to 'ui.c')
-rw-r--r--ui.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/ui.c b/ui.c
index ab557d3..333ef53 100644
--- a/ui.c
+++ b/ui.c
@@ -542,6 +542,7 @@ void uiWrite(uint id, enum Heat heat, const time_t *src, const char *str) {
 	}
 	if (window->mark && heat > Cold) {
 		if (!window->unreadWarm++) {
+			window->unreadSoft++;
 			lines += bufferPush(window->buffer, COLS, false, Cold, ts, "");
 		}
 		if (heat > window->heat) window->heat = heat;
@@ -576,7 +577,9 @@ static void resize(void) {
 	wresize(main, MAIN_LINES, COLS);
 	for (uint num = 0; num < windows.len; ++num) {
 		struct Window *window = windows.ptrs[num];
-		bufferReflow(window->buffer, COLS, window->ignore);
+		window->unreadHard = bufferReflow(
+			window->buffer, COLS, window->ignore, window->unreadSoft
+		);
 	}
 	windowUpdate();
 }
@@ -753,7 +756,9 @@ void uiCloseNum(uint num) {
 
 static void toggleIgnore(struct Window *window) {
 	window->ignore ^= true;
-	bufferReflow(window->buffer, COLS, window->ignore);
+	window->unreadHard = bufferReflow(
+		window->buffer, COLS, window->ignore, window->unreadSoft
+	);
 	windowUpdate();
 	statusUpdate();
 }
@@ -1015,6 +1020,9 @@ void uiLoad(const char *name) {
 			readString(file, &buf, &cap);
 			bufferPush(window->buffer, COLS, window->ignore, heat, time, buf);
 		}
+		window->unreadHard = bufferReflow(
+			window->buffer, COLS, window->ignore, window->unreadSoft
+		);
 	}
 
 	free(buf);