New command, join-pane, to split and move an existing pane into the space (like

splitw then movep, or the reverse of breakp).
This commit is contained in:
Nicholas Marriott
2010-01-07 20:52:18 +00:00
parent 519c6fc7e7
commit 6a45fab608
7 changed files with 306 additions and 19 deletions

View File

@ -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. */