mirror of
https://github.com/tmux/tmux.git
synced 2026-05-30 22:26:18 +00:00
Add new-pane command, currently this is equivalent to split-window but
it will have minor differences for floating panes in future. Also add -R/-s/-S/-k/-m flags to control border and style and behaviour, like popups. GitHub issue 5027 from Dane Jensen.
This commit is contained in:
50
window.c
50
window.c
@@ -2021,3 +2021,53 @@ window_pane_border_status_get_range(struct window_pane *wp, u_int x, u_int y)
|
||||
*/
|
||||
return (style_ranges_get_range(srs, x - wp->xoff - 2));
|
||||
}
|
||||
|
||||
int
|
||||
window_pane_tile_geometry(struct window *w, struct window_pane *wp,
|
||||
int *out_size, int *out_flags, enum layout_type *out_type,
|
||||
struct cmdq_item *item, struct args *args, char **cause)
|
||||
{
|
||||
int size = -1, flags = *out_flags;
|
||||
enum layout_type type;
|
||||
u_int curval = 0;
|
||||
|
||||
type = LAYOUT_TOPBOTTOM;
|
||||
if (args_has(args, 'h'))
|
||||
type = LAYOUT_LEFTRIGHT;
|
||||
|
||||
if (args_has(args, 'l') || args_has(args, 'p')) {
|
||||
if (args_has(args, 'f')) {
|
||||
if (type == LAYOUT_TOPBOTTOM)
|
||||
curval = w->sy;
|
||||
else
|
||||
curval = w->sx;
|
||||
} else {
|
||||
if (type == LAYOUT_TOPBOTTOM)
|
||||
curval = wp->sy;
|
||||
else
|
||||
curval = wp->sx;
|
||||
}
|
||||
}
|
||||
|
||||
if (args_has(args, 'l')) {
|
||||
size = args_percentage_and_expand(args, 'l', 0, INT_MAX, curval,
|
||||
item, cause);
|
||||
} else if (args_has(args, 'p')) {
|
||||
size = args_strtonum_and_expand(args, 'p', 0, 100, item,
|
||||
cause);
|
||||
if (cause == NULL)
|
||||
size = curval * size / 100;
|
||||
}
|
||||
if (*cause != NULL)
|
||||
return (-1);
|
||||
|
||||
if (args_has(args, 'b'))
|
||||
flags |= SPAWN_BEFORE;
|
||||
if (args_has(args, 'f'))
|
||||
flags |= SPAWN_FULLSIZE;
|
||||
|
||||
*out_size = size;
|
||||
*out_flags = flags;
|
||||
*out_type = type;
|
||||
return (0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user