summaryrefslogtreecommitdiffstats
path: root/layout-set.c
diff options
context:
space:
mode:
authorTiago Cunha <tcunha@gmx.com>2010-02-05 01:29:04 +0000
committerTiago Cunha <tcunha@gmx.com>2010-02-05 01:29:04 +0000
commit23fb261b85b2e63657c490e4eeed36aa323e16f4 (patch)
tree8672c1bbaed635963097138911305d99c40ea2d1 /layout-set.c
parent0d5542e65e5f909d63bc26a676eecacaa7ede093 (diff)
Sync OpenBSD patchset 631:
Fix divide by zero on small windows with main-* layouts.
Diffstat (limited to 'layout-set.c')
-rw-r--r--layout-set.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/layout-set.c b/layout-set.c
index 96231fb4..e3275142 100644
--- a/layout-set.c
+++ b/layout-set.c
@@ -1,4 +1,4 @@
-/* $Id: layout-set.c,v 1.4 2009-12-04 22:14:47 tcunha Exp $ */
+/* $Id: layout-set.c,v 1.5 2010-02-05 01:29:04 tcunha Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -244,6 +244,8 @@ layout_set_main_h(struct window *w)
/* How many rows and columns will be needed? */
columns = w->sx / (PANE_MINIMUM + 1); /* maximum columns */
+ if (columns == 0)
+ columns = 1;
rows = 1 + (n - 1) / columns;
columns = 1 + (n - 1) / rows;
width = w->sx / columns;
@@ -353,6 +355,8 @@ layout_set_main_v(struct window *w)
/* How many rows and columns will be needed? */
rows = w->sy / (PANE_MINIMUM + 1); /* maximum rows */
+ if (rows == 0)
+ rows = 1;
columns = 1 + (n - 1) / rows;
rows = 1 + (n - 1) / columns;
height = w->sy / rows;