Break new window and pane creation common code from various commands and

window.c into a separate file spawn.c.
This commit is contained in:
nicm
2019-04-17 14:37:48 +00:00
parent 835ccbac46
commit 78287e27c8
22 changed files with 709 additions and 613 deletions

View File

@ -72,7 +72,7 @@ cmd_join_pane_exec(struct cmd *self, struct cmdq_item *item)
int size, percentage, dst_idx;
enum layout_type type;
struct layout_cell *lc;
int not_same_window;
int not_same_window, flags;
if (self->entry == &cmd_join_pane_entry)
not_same_window = 1;
@ -124,7 +124,11 @@ cmd_join_pane_exec(struct cmd *self, struct cmdq_item *item)
else
size = (dst_wp->sx * percentage) / 100;
}
lc = layout_split_pane(dst_wp, type, size, args_has(args, 'b'), 0);
if (args_has(args, 'b'))
flags = SPAWN_BEFORE;
else
flags = 0;
lc = layout_split_pane(dst_wp, type, size, flags);
if (lc == NULL) {
cmdq_error(item, "create pane failed: pane too small");
return (CMD_RETURN_ERROR);
@ -145,7 +149,7 @@ cmd_join_pane_exec(struct cmd *self, struct cmdq_item *item)
server_redraw_window(dst_w);
if (!args_has(args, 'd')) {
window_set_active_pane(dst_w, src_wp);
window_set_active_pane(dst_w, src_wp, 1);
session_select(dst_s, dst_idx);
cmd_find_from_session(current, dst_s, 0);
server_redraw_session(dst_s);