diff options
author | Thomas Adam <thomas@xteddy.org> | 2016-10-16 22:01:14 +0100 |
---|---|---|
committer | Thomas Adam <thomas@xteddy.org> | 2016-10-16 22:01:14 +0100 |
commit | 1a6e696b08113ca17ee8e881844167cf94276846 (patch) | |
tree | 60ecdd8c9e51bff46624e48d9373686b858d2fb1 /cmd-split-window.c | |
parent | d401340c516131ae8e07bfb978b670347486d077 (diff) | |
parent | d15d54c2c8e6b95695169442eb2a27d814efc078 (diff) | |
download | rtmux-1a6e696b08113ca17ee8e881844167cf94276846.tar.gz rtmux-1a6e696b08113ca17ee8e881844167cf94276846.tar.bz2 rtmux-1a6e696b08113ca17ee8e881844167cf94276846.zip |
Merge branch 'obsd-master'
Diffstat (limited to 'cmd-split-window.c')
-rw-r--r-- | cmd-split-window.c | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/cmd-split-window.c b/cmd-split-window.c index 013391a6..5a724c36 100644 --- a/cmd-split-window.c +++ b/cmd-split-window.c @@ -32,7 +32,8 @@ #define SPLIT_WINDOW_TEMPLATE "#{session_name}:#{window_index}.#{pane_index}" -static enum cmd_retval cmd_split_window_exec(struct cmd *, struct cmd_q *); +static enum cmd_retval cmd_split_window_exec(struct cmd *, + struct cmdq_item *); const struct cmd_entry cmd_split_window_entry = { .name = "split-window", @@ -49,13 +50,13 @@ const struct cmd_entry cmd_split_window_entry = { }; static enum cmd_retval -cmd_split_window_exec(struct cmd *self, struct cmd_q *cmdq) +cmd_split_window_exec(struct cmd *self, struct cmdq_item *item) { struct args *args = self->args; - struct session *s = cmdq->state.tflag.s; - struct winlink *wl = cmdq->state.tflag.wl; + struct session *s = item->state.tflag.s; + struct winlink *wl = item->state.tflag.wl; struct window *w = wl->window; - struct window_pane *wp = cmdq->state.tflag.wp, *new_wp = NULL; + struct window_pane *wp = item->state.tflag.wp, *new_wp = NULL; struct environ *env; const char *cmd, *path, *shell, *template, *cwd, *to_free; char **argv, *cause, *new_cause, *cp; @@ -90,12 +91,12 @@ cmd_split_window_exec(struct cmd *self, struct cmd_q *cmdq) to_free = NULL; if (args_has(args, 'c')) { - ft = format_create(cmdq, 0); - format_defaults(ft, cmdq->state.c, s, NULL, NULL); + ft = format_create(item, 0); + format_defaults(ft, item->state.c, s, NULL, NULL); to_free = cwd = format_expand(ft, args_get(args, 'c')); format_free(ft); - } else if (cmdq->client != NULL && cmdq->client->session == NULL) - cwd = cmdq->client->cwd; + } else if (item->client != NULL && item->client->session == NULL) + cwd = item->client->cwd; else cwd = s->cwd; @@ -141,8 +142,8 @@ cmd_split_window_exec(struct cmd *self, struct cmd_q *cmdq) layout_assign_pane(lc, new_wp); path = NULL; - if (cmdq->client != NULL && cmdq->client->session == NULL) - envent = environ_find(cmdq->client->environ, "PATH"); + if (item->client != NULL && item->client->session == NULL) + envent = environ_find(item->client->environ, "PATH"); else envent = environ_find(s->environ, "PATH"); if (envent != NULL) @@ -167,11 +168,11 @@ cmd_split_window_exec(struct cmd *self, struct cmd_q *cmdq) if ((template = args_get(args, 'F')) == NULL) template = SPLIT_WINDOW_TEMPLATE; - ft = format_create(cmdq, 0); - format_defaults(ft, cmdq->state.c, s, wl, new_wp); + ft = format_create(item, 0); + format_defaults(ft, item->state.c, s, wl, new_wp); cp = format_expand(ft, template); - cmdq_print(cmdq, "%s", cp); + cmdq_print(item, "%s", cp); free(cp); format_free(ft); @@ -187,7 +188,7 @@ cmd_split_window_exec(struct cmd *self, struct cmd_q *cmdq) fs.w = w; fs.wp = new_wp; cmd_find_log_state(__func__, &fs); - hooks_insert(s->hooks, cmdq, &fs, "after-split-window"); + hooks_insert(s->hooks, item, &fs, "after-split-window"); return (CMD_RETURN_NORMAL); @@ -197,7 +198,7 @@ error: layout_close_pane(new_wp); window_remove_pane(w, new_wp); } - cmdq_error(cmdq, "create pane failed: %s", cause); + cmdq_error(item, "create pane failed: %s", cause); free(cause); if (to_free != NULL) |