summary refs log tree commit diff
diff options
context:
space:
mode:
authorC. McEnroe2020-04-02 10:56:33 -0400
committerC. McEnroe2020-04-02 10:56:33 -0400
commit9063c656d516b1842f9078cd9bb4cd5f1fd4a14a (patch)
tree89d79e5784c4a2d6a3d9af8ee1e4d02a8ea90b40
parent6333b632240cddaa9d59bfc0722d68b045e827d0 (diff)
Preserve the last blank line on reflow
-rw-r--r--ui.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/ui.c b/ui.c
index 023de21..f4e1200 100644
--- a/ui.c
+++ b/ui.c
@@ -636,7 +636,12 @@ static void reflow(struct Window *window) {
 		struct Line line = bufferLine(&window->buffer, i);
 		if (!line.str) continue;
 		if (line.heat < Cold && window->ignore) continue;
-		int lines = wordWrap(window->pad, line.str);
+		int lines = 0;
+		if (i == (size_t)(BufferCap - window->unread)) {
+			waddch(window->pad, '\n');
+			lines++;
+		}
+		lines += wordWrap(window->pad, line.str);
 		if (i >= (size_t)(BufferCap - window->unread)) {
 			window->unreadLines += lines;
 		}