about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2021-01-26 19:33:17 -0500
committerJune McEnroe <june@causal.agency>2021-01-26 19:33:17 -0500
commit76670b2fb145307c93f39ff859cfc7cb20c21ce9 (patch)
tree8cb24324f8f9643c838845948d4dbec55c3792a1
parentUse Warm heat for replies to user-initiated commands (diff)
downloadcatgirl-76670b2fb145307c93f39ff859cfc7cb20c21ce9.tar.gz
catgirl-76670b2fb145307c93f39ff859cfc7cb20c21ce9.zip
Factor out windowReflow
Diffstat (limited to '')
-rw-r--r--ui.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/ui.c b/ui.c
index a0bee13..a43719c 100644
--- a/ui.c
+++ b/ui.c
@@ -597,15 +597,18 @@ void uiFormat(
 	uiWrite(id, heat, time, buf);
 }
 
+static void windowReflow(struct Window *window) {
+	window->unreadHard = bufferReflow(
+		window->buffer, COLS, window->thresh, window->unreadSoft
+	);
+}
+
 static void resize(void) {
 	statusUpdate();
 	wclear(main);
 	wresize(main, MAIN_LINES, COLS);
 	for (uint num = 0; num < windows.len; ++num) {
-		struct Window *window = windows.ptrs[num];
-		window->unreadHard = bufferReflow(
-			window->buffer, COLS, window->thresh, window->unreadSoft
-		);
+		windowReflow(windows.ptrs[num]);
 	}
 	windowUpdate();
 }
@@ -792,9 +795,7 @@ static void incThresh(struct Window *window, int n) {
 	} else {
 		window->thresh += n;
 	}
-	window->unreadHard = bufferReflow(
-		window->buffer, COLS, window->thresh, window->unreadSoft
-	);
+	windowReflow(window);
 	windowUpdate();
 	statusUpdate();
 }
@@ -1065,9 +1066,7 @@ void uiLoad(const char *name) {
 			readString(file, &buf, &cap);
 			bufferPush(window->buffer, COLS, window->thresh, heat, time, buf);
 		}
-		window->unreadHard = bufferReflow(
-			window->buffer, COLS, window->thresh, window->unreadSoft
-		);
+		windowReflow(window);
 	}
 	urlLoad(file, version);