From 6a45fab608a7430757db38c3bf3ab67a042b7abb Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Thu, 7 Jan 2010 20:52:18 +0000 Subject: New command, join-pane, to split and move an existing pane into the space (like splitw then movep, or the reverse of breakp). --- layout.c | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) (limited to 'layout.c') diff --git a/layout.c b/layout.c index 7835e3f9..2d7fd596 100644 --- a/layout.c +++ b/layout.c @@ -485,10 +485,20 @@ layout_resize_pane_shrink( return (size); } -/* Split a pane into two. size is a hint, or -1 for default half/half split. */ -int -layout_split_pane(struct window_pane *wp, - enum layout_type type, int size, struct window_pane *new_wp) +/* Assign window pane to newly split cell. */ +void +layout_assign_pane(struct layout_cell *lc, struct window_pane *wp) +{ + layout_make_leaf(lc, wp); + layout_fix_panes(wp->window, wp->window->sx, wp->window->sy); +} + +/* + * Split a pane into two. size is a hint, or -1 for default half/half + * 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; @@ -505,11 +515,11 @@ layout_split_pane(struct window_pane *wp, switch (type) { case LAYOUT_LEFTRIGHT: if (sx < PANE_MINIMUM * 2 + 1) - return (-1); + return (NULL); break; case LAYOUT_TOPBOTTOM: if (sy < PANE_MINIMUM * 2 + 1) - return (-1); + return (NULL); break; default: fatalx("bad layout type"); @@ -583,12 +593,8 @@ layout_split_pane(struct window_pane *wp, /* Assign the panes. */ layout_make_leaf(lc, wp); - layout_make_leaf(lcnew, new_wp); - - /* Fix pane offsets and sizes. */ - layout_fix_panes(wp->window, wp->window->sx, wp->window->sy); - return (0); + return (lcnew); } /* Destroy the layout associated with a pane and redistribute the space. */ -- cgit