From 93ae428d1589bd77af65b994530c1deeba736d54 Mon Sep 17 00:00:00 2001
From: Alcor <alcor@tilde.club>
Date: Wed, 20 May 2026 12:04:00 +0200
Subject: [PATCH 02/19] avoid infinite loop during reflows if cols=0

happens rarely if the window is resized to a very small size
---
 buffer.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/buffer.c b/buffer.c
index 6a7b412..d35cddd 100644
--- a/buffer.c
+++ b/buffer.c
@@ -99,6 +99,8 @@ static const wchar_t ZWS = L'\u200B';
 static const wchar_t ZWNJ = L'\u200C';
 
 static int flow(struct Lines *hard, int cols, const struct Line *soft) {
+	if (cols < 1) cols = 1; /* avoid infinite loop if cols=0 */
+
 	int flowed = 1;
 
 	struct Line *line = linesNext(hard);
-- 
2.47.3

