version 1.34, 2012/07/10 11:53:01 |
version 1.35, 2012/07/11 07:10:15 |
|
|
* Split a window (add a new pane). |
* Split a window (add a new pane). |
*/ |
*/ |
|
|
void cmd_split_window_key_binding(struct cmd *, int); |
void cmd_split_window_key_binding(struct cmd *, int); |
int cmd_split_window_exec(struct cmd *, struct cmd_ctx *); |
enum cmd_retval cmd_split_window_exec(struct cmd *, struct cmd_ctx *); |
|
|
const struct cmd_entry cmd_split_window_entry = { |
const struct cmd_entry cmd_split_window_entry = { |
"split-window", "splitw", |
"split-window", "splitw", |
|
|
args_set(self->args, 'h', NULL); |
args_set(self->args, 'h', NULL); |
} |
} |
|
|
int |
enum cmd_retval |
cmd_split_window_exec(struct cmd *self, struct cmd_ctx *ctx) |
cmd_split_window_exec(struct cmd *self, struct cmd_ctx *ctx) |
{ |
{ |
struct args *args = self->args; |
struct args *args = self->args; |
|
|
char *cp; |
char *cp; |
|
|
if ((wl = cmd_find_pane(ctx, args_get(args, 't'), &s, &wp)) == NULL) |
if ((wl = cmd_find_pane(ctx, args_get(args, 't'), &s, &wp)) == NULL) |
return (-1); |
return (CMD_RETURN_ERROR); |
w = wl->window; |
w = wl->window; |
|
|
environ_init(&env); |
environ_init(&env); |
|
|
format_free(ft); |
format_free(ft); |
} |
} |
notify_window_layout_changed(w); |
notify_window_layout_changed(w); |
return (0); |
return (CMD_RETURN_NORMAL); |
|
|
error: |
error: |
environ_free(&env); |
environ_free(&env); |
|
|
window_remove_pane(w, new_wp); |
window_remove_pane(w, new_wp); |
ctx->error(ctx, "create pane failed: %s", cause); |
ctx->error(ctx, "create pane failed: %s", cause); |
free(cause); |
free(cause); |
return (-1); |
return (CMD_RETURN_ERROR); |
} |
} |