From a568ea266ee3f19e68f4cae5b00bfe64874dea45 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Deuc=D0=B5?= <shurd@sasktel.net>
Date: Thu, 1 Apr 2021 02:04:32 -0400
Subject: [PATCH] Have showbuf() clamp width the same way as height...

Basically, assume left is correct, and calculate the correct width
to fill the screen to the esge.
---
 src/uifc/uifc32.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/uifc/uifc32.c b/src/uifc/uifc32.c
index 6e0ffa2fce..54a38d9acb 100644
--- a/src/uifc/uifc32.c
+++ b/src/uifc/uifc32.c
@@ -2699,8 +2699,8 @@ void showbuf(int mode, int left, int top, int width, int height, char *title, ch
 		height = api->scrn_len - top;
 	if(!width || (unsigned)width<title_len+6)
 		width=title_len+6;
-	if((unsigned)width>api->scrn_width)
-		width=api->scrn_width;
+	if((unsigned)(width + left) > api->scrn_width)
+		width = api->scrn_width - left + 1;
 	if(mode&WIN_L2R)
 		left=(api->scrn_width-width+2)/2;
 	else if(mode&WIN_RHT)
-- 
GitLab