=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/layout.c,v retrieving revision 1.8 retrieving revision 1.9 diff -c -r1.8 -r1.9 *** src/usr.bin/tmux/layout.c 2012/01/29 09:37:02 1.8 --- src/usr.bin/tmux/layout.c 2012/03/03 08:31:18 1.9 *************** *** 1,4 **** ! /* $OpenBSD: layout.c,v 1.8 2012/01/29 09:37:02 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott --- 1,4 ---- ! /* $OpenBSD: layout.c,v 1.9 2012/03/03 08:31:18 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott *************** *** 616,624 **** * split. This must be followed by layout_assign_pane before much else happens! **/ struct layout_cell * ! layout_split_pane(struct window_pane *wp, enum layout_type type, int size) { ! struct layout_cell *lc, *lcparent, *lcnew; u_int sx, sy, xoff, yoff, size1, size2; lc = wp->layout_cell; --- 616,625 ---- * split. This must be followed by layout_assign_pane before much else happens! **/ struct layout_cell * ! layout_split_pane( ! struct window_pane *wp, enum layout_type type, int size, int insert_before) { ! struct layout_cell *lc, *lcparent, *lcnew, *lc1, *lc2; u_int sx, sy, xoff, yoff, size1, size2; lc = wp->layout_cell; *************** *** 650,657 **** */ /* Create the new child cell. */ ! lcnew = layout_create_cell(lc->parent); ! TAILQ_INSERT_AFTER(&lc->parent->cells, lc, lcnew, entry); } else { /* * Otherwise create a new parent and insert it. --- 651,662 ---- */ /* Create the new child cell. */ ! lcparent = lc->parent; ! lcnew = layout_create_cell(lcparent); ! if (insert_before) ! TAILQ_INSERT_BEFORE(lc, lcnew, entry); ! else ! TAILQ_INSERT_AFTER(&lcparent->cells, lc, lcnew, entry); } else { /* * Otherwise create a new parent and insert it. *************** *** 672,679 **** /* Create the new child cell. */ lcnew = layout_create_cell(lcparent); ! TAILQ_INSERT_TAIL(&lcparent->cells, lcnew, entry); } /* Set new cell sizes. size is the target size or -1 for middle split, * size1 is the size of the top/left and size2 the bottom/right. --- 677,694 ---- /* Create the new child cell. */ lcnew = layout_create_cell(lcparent); ! if (insert_before) ! TAILQ_INSERT_HEAD(&lcparent->cells, lcnew, entry); ! else ! TAILQ_INSERT_TAIL(&lcparent->cells, lcnew, entry); } + if (insert_before) { + lc1 = lcnew; + lc2 = lc; + } else { + lc1 = lc; + lc2 = lcnew; + } /* Set new cell sizes. size is the target size or -1 for middle split, * size1 is the size of the top/left and size2 the bottom/right. *************** *** 689,696 **** else if (size2 > sx - 2) size2 = sx - 2; size1 = sx - 1 - size2; ! layout_set_size(lc, size1, sy, xoff, yoff); ! layout_set_size(lcnew, size2, sy, xoff + lc->sx + 1, yoff); break; case LAYOUT_TOPBOTTOM: if (size < 0) --- 704,711 ---- else if (size2 > sx - 2) size2 = sx - 2; size1 = sx - 1 - size2; ! layout_set_size(lc1, size1, sy, xoff, yoff); ! layout_set_size(lc2, size2, sy, xoff + lc1->sx + 1, yoff); break; case LAYOUT_TOPBOTTOM: if (size < 0) *************** *** 702,709 **** else if (size2 > sy - 2) size2 = sy - 2; size1 = sy - 1 - size2; ! layout_set_size(lc, sx, size1, xoff, yoff); ! layout_set_size(lcnew, sx, size2, xoff, yoff + lc->sy + 1); break; default: fatalx("bad layout type"); --- 717,724 ---- else if (size2 > sy - 2) size2 = sy - 2; size1 = sy - 1 - size2; ! layout_set_size(lc1, sx, size1, xoff, yoff); ! layout_set_size(lc2, sx, size2, xoff, yoff + lc1->sy + 1); break; default: fatalx("bad layout type");