From 071ea4f534439f0c8dc1be12d385d2add33c4094 Mon Sep 17 00:00:00 2001
From: Alcor <alcor@tilde.club>
Date: Wed, 20 May 2026 15:37:52 +0200
Subject: [PATCH 03/19] guard against excessive terminal resizes

---
 ui.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/ui.c b/ui.c
index df675b1..4de65c3 100644
--- a/ui.c
+++ b/ui.c
@@ -120,10 +120,10 @@ void uiInit(void) {
 		from_status_line = "\7";
 	}
 
-	uiStatus = newwin(StatusLines, COLS, 0, 0);
+	uiStatus = newwin(StatusLines, 0 /* FILL */, 0, 0);
 	if (!uiStatus) err(1, "newwin");
 
-	uiMain = newwin(MAIN_LINES, COLS, StatusLines, 0);
+	uiMain = newwin(MAIN_LINES <= 0 ? 1 : MAIN_LINES, 0 /* FILL */, StatusLines, 0);
 	if (!uiMain) err(1, "newwin");
 
 	uiInput = newpad(InputLines, InputCols);
@@ -273,7 +273,7 @@ void uiFormat(
 
 void uiResize(void) {
 	wclear(uiMain);
-	wresize(uiMain, MAIN_LINES, COLS);
+	wresize(uiMain, MAIN_LINES <= 0 ? 1 : MAIN_LINES, COLS <= 0 ? 1 : COLS);
 	windowResize();
 }
 
-- 
2.47.3

