From 9dc8d7c2008c3c698c2e018c3ec123e6dd622f5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Amadeusz=20S=C5=82awi=C5=84ski?= Date: Thu, 11 Sep 2014 17:02:57 +0200 Subject: Set maximum width(/height) in one place MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Should also fix https://savannah.gnu.org/bugs/?38940 Signed-off-by: Amadeusz Sławiński --- src/resize.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/resize.c b/src/resize.c index 8c107da..ba30b26 100644 --- a/src/resize.c +++ b/src/resize.c @@ -42,6 +42,9 @@ #include "screen.h" #include "extern.h" +/* maximum window width */ +#define MAXWIDTH 1000 + static void CheckMaxSize __P((int)); static void FreeMline __P((struct mline *)); static int AllocMline __P((struct mline *ml, int)); @@ -530,7 +533,8 @@ int wi; int i; struct mline *ml; - wi = ((wi + 1) + 255) & ~255; + if (wi > MAXWIDTH) + wi = MAXWIDTH; if (wi <= maxwidth) return; maxwidth = wi; @@ -666,16 +670,16 @@ int wi, he, hi; if (p->w_type == W_TYPE_GROUP) return 0; - if (wi > 1000) + if (wi > MAXWIDTH) { - Msg(0, "Window width too large. Truncated to 1000."); - wi = 1000; + Msg(0, "Window width too large. Truncated to %d.", MAXWIDTH); + wi = MAXWIDTH; } - if (he > 1000) + if (he > MAXWIDTH) { - Msg(0, "Window height too large. Truncated to 1000."); - he = 1000; + Msg(0, "Window height too large. Truncated to %d.", MAXWIDTH); + he = MAXWIDTH; } if (p->w_width == wi && p->w_height == he && p->w_histheight == hi) -- cgit v1.2.1