diff options
author | Nicholas Marriott <nicholas.marriott@gmail.com> | 2009-04-01 18:48:09 +0000 |
---|---|---|
committer | Nicholas Marriott <nicholas.marriott@gmail.com> | 2009-04-01 18:48:09 +0000 |
commit | d4947fc4cbec854762817c2ceadefb3410a66b8f (patch) | |
tree | ce8ecf396a5cc5cf2bca609f461b2c0d1d18332b /layout.c | |
parent | 673290d01966a3a64e4ae6e3a295e5f698ffe4a1 (diff) |
Handle 0 panes better.
Diffstat (limited to 'layout.c')
-rw-r--r-- | layout.c | 23 |
1 files changed, 18 insertions, 5 deletions
@@ -1,4 +1,4 @@ -/* $Id: layout.c,v 1.1 2009-04-01 18:21:32 nicm Exp $ */ +/* $Id: layout.c,v 1.2 2009-04-01 18:48:09 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net> @@ -83,8 +83,12 @@ layout_even_horizontal(struct window *w) struct window_pane *wp; u_int i, n, width, xoff; - /* How many can we fit? */ + /* Get number of panes. */ n = window_count_panes(w); + if (n == 0) + return; + + /* How many can we fit? */ if (w->sx / n < PANE_MINIMUM) { width = PANE_MINIMUM; n = w->sx / PANE_MINIMUM; @@ -124,8 +128,12 @@ layout_even_vertical(struct window *w) struct window_pane *wp; u_int i, n, height, yoff; - /* How many can we fit? */ + /* Get number of panes. */ n = window_count_panes(w); + if (n == 0) + return; + + /* How many can we fit? */ if (w->sy / n < PANE_MINIMUM) { height = PANE_MINIMUM; n = w->sy / PANE_MINIMUM; @@ -165,12 +173,17 @@ layout_left_vertical(struct window *w) struct window_pane *wp; u_int i, n, height, yoff; + /* Get number of panes. */ + n = window_count_panes(w); + if (n == 0) + return; + /* Need >1 pane and minimum columns; if fewer, display active only. */ - n = window_count_panes(w) - 1; - if (n == 0 || w->sx < 82 + PANE_MINIMUM) { + if (n == 1 || w->sx < 82 + PANE_MINIMUM) { layout_active_only(w); return; } + n--; /* How many can we fit, not including first? */ if (w->sy / n < PANE_MINIMUM) { |