summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-09-02 15:57:36 -0400
committerJune McEnroe <june@causal.agency>2020-09-02 15:57:36 -0400
commita0c8a46c750ff166c7a53a28c2bf04e04575c497 (patch)
tree781c754c981cfdf5972c71fb18de1509930ad88f
parentOnly call windowUpdate when the shown window needs updating (diff)
downloadcatgirl-a0c8a46c750ff166c7a53a28c2bf04e04575c497.tar.gz
catgirl-a0c8a46c750ff166c7a53a28c2bf04e04575c497.zip
Fix inserting blank lines BEFORE the new message
-rw-r--r--ui.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/ui.c b/ui.c
index 9e86000..18af635 100644
--- a/ui.c
+++ b/ui.c
@@ -520,10 +520,12 @@ static void notify(uint id, const char *str) {
 void uiWrite(uint id, enum Heat heat, const time_t *src, const char *str) {
 	struct Window *window = windows.ptrs[windowFor(id)];
 	time_t ts = (src ? *src : time(NULL));
+	if (heat < Cold && window->ignore) {
+		bufferPush(window->buffer, COLS, heat, ts, str);
+		return;
+	}
 
-	int lines = bufferPush(window->buffer, COLS, heat, ts, str);
-	if (heat < Cold && window->ignore) return;
-
+	int lines = 0;
 	if (!window->unreadSoft++) window->unreadHard = 0;
 	if (window->mark && heat > Cold) {
 		if (!window->unreadWarm++) {
@@ -532,6 +534,7 @@ void uiWrite(uint id, enum Heat heat, const time_t *src, const char *str) {
 		if (heat > window->heat) window->heat = heat;
 		statusUpdate();
 	}
+	lines += bufferPush(window->buffer, COLS, heat, ts, str);
 	window->unreadHard += lines;
 	if (window->scroll) windowScroll(window, lines);
 	if (window == windows.ptrs[windows.show]) windowUpdate();