summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-09-01 20:56:09 -0400
committerJune McEnroe <june@causal.agency>2020-09-01 20:56:09 -0400
commit8d1d7580538a082075a7b2d758f0e985ea1a7e42 (patch)
tree07d115e188061edbb2da9aaaedbf89d7eafd1645
parentFactor buffer out of ui (diff)
downloadcatgirl-8d1d7580538a082075a7b2d758f0e985ea1a7e42.tar.gz
catgirl-8d1d7580538a082075a7b2d758f0e985ea1a7e42.zip
Invert meaning of unreadHard/unreadSoft to match new buffer code
Not sure why I had named them this way. Hard means hard-wrapped.
-rw-r--r--ui.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/ui.c b/ui.c
index ba4ce67..455d057 100644
--- a/ui.c
+++ b/ui.c
@@ -82,8 +82,8 @@ struct Window {
 	bool mute;
 	bool ignore;
 	enum Heat heat;
-	uint unreadHard;
 	uint unreadSoft;
+	uint unreadHard;
 	uint unreadWarm;
 	struct Buffer *buffer;
 };
@@ -449,7 +449,7 @@ static void statusUpdate(void) {
 static void mark(struct Window *window) {
 	if (window->scroll) return;
 	window->mark = true;
-	window->unreadHard = 0;
+	window->unreadSoft = 0;
 	window->unreadWarm = 0;
 }
 
@@ -496,7 +496,7 @@ static void windowScrollPage(struct Window *window, int n) {
 
 static void windowScrollUnread(struct Window *window) {
 	window->scroll = 0;
-	windowScroll(window, window->unreadSoft - MAIN_LINES);
+	windowScroll(window, window->unreadHard - MAIN_LINES);
 }
 
 static int wordWidth(const char *str) {
@@ -600,7 +600,7 @@ void uiWrite(uint id, enum Heat heat, const time_t *src, const char *str) {
 	if (heat < Cold && window->ignore) return;
 
 	int lines = 0;
-	if (!window->unreadHard++) window->unreadSoft = 0;
+	if (!window->unreadSoft++) window->unreadHard = 0;
 	if (window->mark && heat > Cold) {
 		if (!window->unreadWarm++) {
 			lines++;
@@ -611,7 +611,7 @@ void uiWrite(uint id, enum Heat heat, const time_t *src, const char *str) {
 	}
 
 	lines += wordWrap(window->pad, str);
-	window->unreadSoft += lines;
+	window->unreadHard += lines;
 	if (window->scroll) windowScroll(window, lines);
 
 	if (window->mark && heat > Warm) {
@@ -637,19 +637,19 @@ static void reflow(struct Window *window) {
 	wmove(window->pad, 0, 0);
 
 	int flowed = 0;
-	window->unreadSoft = 0;
+	window->unreadHard = 0;
 	for (size_t i = 0; i < BufferCap; ++i) {
 		const struct Line *line = bufferSoft(window->buffer, i);
 		if (!line) continue;
 		if (line->heat < Cold && window->ignore) continue;
 		int lines = 0;
-		if (i == (size_t)(BufferCap - window->unreadHard)) {
+		if (i == (size_t)(BufferCap - window->unreadSoft)) {
 			waddch(window->pad, '\n');
 			lines++;
 		}
 		lines += wordWrap(window->pad, line->str);
-		if (i >= (size_t)(BufferCap - window->unreadHard)) {
-			window->unreadSoft += lines;
+		if (i >= (size_t)(BufferCap - window->unreadSoft)) {
+			window->unreadHard += lines;
 		}
 		flowed += lines;
 	}
@@ -1028,7 +1028,7 @@ int uiSave(const char *name) {
 		if (writeString(file, idNames[window->id])) return -1;
 		if (writeTime(file, window->mute)) return -1;
 		if (writeTime(file, window->heat)) return -1;
-		if (writeTime(file, window->unreadHard)) return -1;
+		if (writeTime(file, window->unreadSoft)) return -1;
 		if (writeTime(file, window->unreadWarm)) return -1;
 		for (size_t i = 0; i < BufferCap; ++i) {
 			const struct Line *line = bufferSoft(window->buffer, i);
@@ -1085,7 +1085,7 @@ void uiLoad(const char *name) {
 		if (version > 3) window->mute = readTime(file);
 		if (version > 0) {
 			window->heat = readTime(file);
-			window->unreadHard = readTime(file);
+			window->unreadSoft = readTime(file);
 			window->unreadWarm = readTime(file);
 		}
 		for (;;) {