=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/layout-set.c,v retrieving revision 1.28 retrieving revision 1.29 diff -c -r1.28 -r1.29 *** src/usr.bin/tmux/layout-set.c 2019/11/28 09:45:15 1.28 --- src/usr.bin/tmux/layout-set.c 2020/04/22 06:57:13 1.29 *************** *** 1,4 **** ! /* $OpenBSD: layout-set.c,v 1.28 2019/11/28 09:45:15 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott --- 1,4 ---- ! /* $OpenBSD: layout-set.c,v 1.29 2020/04/22 06:57:13 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott *************** *** 18,23 **** --- 18,24 ---- #include + #include #include #include "tmux.h" *************** *** 186,191 **** --- 187,194 ---- struct window_pane *wp; struct layout_cell *lc, *lcmain, *lcother, *lcchild; u_int n, mainh, otherh, sx, sy; + char *cause; + const char *s; layout_print_cell(w->layout_root, __func__, 1); *************** *** 198,205 **** /* Find available height - take off one line for the border. */ sy = w->sy - 1; ! /* Get the main pane height and work out the other pane height. */ ! mainh = options_get_number(w->options, "main-pane-height"); if (mainh + PANE_MINIMUM >= sy) { if (sy <= PANE_MINIMUM + PANE_MINIMUM) mainh = PANE_MINIMUM; --- 201,215 ---- /* Find available height - take off one line for the border. */ sy = w->sy - 1; ! /* Get the main pane height. */ ! s = options_get_string(w->options, "main-pane-height"); ! mainh = args_string_percentage(s, 0, sy, sy, &cause); ! if (cause != NULL) { ! mainh = 24; ! free(cause); ! } ! ! /* Work out the other pane height. */ if (mainh + PANE_MINIMUM >= sy) { if (sy <= PANE_MINIMUM + PANE_MINIMUM) mainh = PANE_MINIMUM; *************** *** 207,216 **** mainh = sy - PANE_MINIMUM; otherh = PANE_MINIMUM; } else { ! otherh = options_get_number(w->options, "other-pane-height"); ! if (otherh == 0) otherh = sy - mainh; ! else if (otherh > sy || sy - otherh < mainh) otherh = sy - mainh; else mainh = sy - otherh; --- 217,228 ---- mainh = sy - PANE_MINIMUM; otherh = PANE_MINIMUM; } else { ! s = options_get_string(w->options, "other-pane-height"); ! otherh = args_string_percentage(s, 0, sy, sy, &cause); ! if (cause != NULL || otherh == 0) { otherh = sy - mainh; ! free(cause); ! } else if (otherh > sy || sy - otherh < mainh) otherh = sy - mainh; else mainh = sy - otherh; *************** *** 273,278 **** --- 285,292 ---- struct window_pane *wp; struct layout_cell *lc, *lcmain, *lcother, *lcchild; u_int n, mainw, otherw, sx, sy; + char *cause; + const char *s; layout_print_cell(w->layout_root, __func__, 1); *************** *** 285,292 **** /* Find available width - take off one line for the border. */ sx = w->sx - 1; ! /* Get the main pane width and work out the other pane width. */ ! mainw = options_get_number(w->options, "main-pane-width"); if (mainw + PANE_MINIMUM >= sx) { if (sx <= PANE_MINIMUM + PANE_MINIMUM) mainw = PANE_MINIMUM; --- 299,313 ---- /* Find available width - take off one line for the border. */ sx = w->sx - 1; ! /* Get the main pane width. */ ! s = options_get_string(w->options, "main-pane-width"); ! mainw = args_string_percentage(s, 0, sx, sx, &cause); ! if (cause != NULL) { ! mainw = 80; ! free(cause); ! } ! ! /* Work out the other pane width. */ if (mainw + PANE_MINIMUM >= sx) { if (sx <= PANE_MINIMUM + PANE_MINIMUM) mainw = PANE_MINIMUM; *************** *** 294,303 **** mainw = sx - PANE_MINIMUM; otherw = PANE_MINIMUM; } else { ! otherw = options_get_number(w->options, "other-pane-width"); ! if (otherw == 0) otherw = sx - mainw; ! else if (otherw > sx || sx - otherw < mainw) otherw = sx - mainw; else mainw = sx - otherw; --- 315,326 ---- mainw = sx - PANE_MINIMUM; otherw = PANE_MINIMUM; } else { ! s = options_get_string(w->options, "other-pane-width"); ! otherw = args_string_percentage(s, 0, sx, sx, &cause); ! if (cause != NULL || otherw == 0) { otherw = sx - mainw; ! free(cause); ! } else if (otherw > sx || sx - otherw < mainw) otherw = sx - mainw; else mainw = sx - otherw;