diff options
56 files changed, 605 insertions, 598 deletions
diff --git a/cmd-attach-session.c b/cmd-attach-session.c index 00ced9df..c29e9d1a 100644 --- a/cmd-attach-session.c +++ b/cmd-attach-session.c @@ -36,48 +36,27 @@ const struct cmd_entry cmd_attach_session_entry = { "attach-session", "attach", "c:dErt:", 0, 0, "[-dEr] [-c working-directory] " CMD_TARGET_SESSION_USAGE, - CMD_STARTSERVER, + CMD_STARTSERVER|CMD_SESSION_T|CMD_PANE_T|CMD_PREFERUNATTACHED, cmd_attach_session_exec }; enum cmd_retval -cmd_attach_session(struct cmd_q *cmdq, const char *tflag, int dflag, int rflag, - const char *cflag, int Eflag) +cmd_attach_session(struct cmd_q *cmdq, int dflag, int rflag, const char *cflag, + int Eflag) { - struct session *s; + struct session *s = cmdq->state.tflag.s; struct client *c = cmdq->client, *c_loop; - struct winlink *wl = NULL; - struct window *w = NULL; - struct window_pane *wp = NULL; + struct winlink *wl = cmdq->state.tflag.wl; + struct window_pane *wp = cmdq->state.tflag.wp; const char *update; - char *cause; + char *cause, *cwd; struct format_tree *ft; - char *cwd; if (RB_EMPTY(&sessions)) { cmdq_error(cmdq, "no sessions"); return (CMD_RETURN_ERROR); } - if (tflag == NULL) { - if ((s = cmd_find_session(cmdq, tflag, 1)) == NULL) - return (CMD_RETURN_ERROR); - } else if (tflag[strcspn(tflag, ":.")] != '\0') { - if ((wl = cmd_find_pane(cmdq, tflag, &s, &wp)) == NULL) - return (CMD_RETURN_ERROR); - } else { - if ((s = cmd_find_session(cmdq, tflag, 1)) == NULL) - return (CMD_RETURN_ERROR); - w = window_find_by_id_str(tflag); - if (w == NULL) { - wp = window_pane_find_by_id_str(tflag); - if (wp != NULL) - w = wp->window; - } - if (w != NULL) - wl = winlink_find_by_window(&s->windows, w); - } - if (c == NULL) return (CMD_RETURN_NORMAL); if (server_client_check_nested(c)) { @@ -94,8 +73,7 @@ cmd_attach_session(struct cmd_q *cmdq, const char *tflag, int dflag, int rflag, if (cflag != NULL) { ft = format_create(cmdq, 0); - format_defaults(ft, cmd_find_client(cmdq, NULL, 1), s, - NULL, NULL); + format_defaults(ft, c, s, wl, wp); cwd = format_expand(ft, cflag); format_free(ft); @@ -176,7 +154,6 @@ cmd_attach_session_exec(struct cmd *self, struct cmd_q *cmdq) { struct args *args = self->args; - return (cmd_attach_session(cmdq, args_get(args, 't'), - args_has(args, 'd'), args_has(args, 'r'), args_get(args, 'c'), - args_has(args, 'E'))); + return (cmd_attach_session(cmdq, args_has(args, 'd'), + args_has(args, 'r'), args_get(args, 'c'), args_has(args, 'E'))); } diff --git a/cmd-break-pane.c b/cmd-break-pane.c index 98d6ad3d..eb07fb87 100644 --- a/cmd-break-pane.c +++ b/cmd-break-pane.c @@ -34,7 +34,7 @@ const struct cmd_entry cmd_break_pane_entry = { "break-pane", "breakp", "dPF:s:t:", 0, 0, "[-dP] [-F format] " CMD_SRCDST_PANE_USAGE, - 0, + CMD_PANE_S|CMD_INDEX_T, cmd_break_pane_exec }; @@ -42,28 +42,22 @@ enum cmd_retval cmd_break_pane_exec(struct cmd *self, struct cmd_q *cmdq) { struct args *args = self->args; - struct winlink *wl; - struct session *src_s; - struct session *dst_s; - struct window_pane *wp; - struct window *w; + struct winlink *wl = cmdq->state.sflag.wl; + struct session *src_s = cmdq->state.sflag.s; + struct session *dst_s = cmdq->state.tflag.s; + struct window_pane *wp = cmdq->state.sflag.wp; + struct window *w = wl->window; char *name; char *cause; - int idx; + int idx = cmdq->state.tflag.idx; struct format_tree *ft; const char *template; char *cp; - wl = cmd_find_pane(cmdq, args_get(args, 's'), &src_s, &wp); - if (wl == NULL) - return (CMD_RETURN_ERROR); - if ((idx = cmd_find_index(cmdq, args_get(args, 't'), &dst_s)) == -2) - return (CMD_RETURN_ERROR); if (idx != -1 && winlink_find_by_index(&dst_s->windows, idx) != NULL) { cmdq_error(cmdq, "index %d already in use", idx); return (CMD_RETURN_ERROR); } - w = wl->window; if (window_count_panes(w) == 1) { cmdq_error(cmdq, "can't break with only one pane"); @@ -102,8 +96,7 @@ cmd_break_pane_exec(struct cmd *self, struct cmd_q *cmdq) template = BREAK_PANE_TEMPLATE; ft = format_create(cmdq, 0); - format_defaults(ft, cmd_find_client(cmdq, NULL, 1), dst_s, wl, - wp); + format_defaults(ft, cmdq->state.c, dst_s, wl, wp); cp = format_expand(ft, template); cmdq_print(cmdq, "%s", cp); diff --git a/cmd-capture-pane.c b/cmd-capture-pane.c index 6a7af47a..9d22a0f2 100644 --- a/cmd-capture-pane.c +++ b/cmd-capture-pane.c @@ -40,7 +40,7 @@ const struct cmd_entry cmd_capture_pane_entry = { "ab:CeE:JpPqS:t:", 0, 0, "[-aCeJpPq] " CMD_BUFFER_USAGE " [-E end-line] [-S start-line]" CMD_TARGET_PANE_USAGE, - 0, + CMD_PANE_T, cmd_capture_pane_exec }; @@ -175,14 +175,11 @@ cmd_capture_pane_exec(struct cmd *self, struct cmd_q *cmdq) { struct args *args = self->args; struct client *c; - struct window_pane *wp; + struct window_pane *wp = cmdq->state.tflag.wp; char *buf, *cause; const char *bufname; size_t len; - if (cmd_find_pane(cmdq, args_get(args, 't'), NULL, &wp) == NULL) - return (CMD_RETURN_ERROR); - len = 0; if (args_has(args, 'P')) buf = cmd_capture_pane_pending(args, wp, &len); diff --git a/cmd-choose-buffer.c b/cmd-choose-buffer.c index dbb20fc4..4418d415 100644 --- a/cmd-choose-buffer.c +++ b/cmd-choose-buffer.c @@ -36,7 +36,7 @@ const struct cmd_entry cmd_choose_buffer_entry = { "choose-buffer", NULL, "F:t:", 0, 1, CMD_TARGET_WINDOW_USAGE " [-F format] [template]", - 0, + CMD_WINDOW_T, cmd_choose_buffer_exec }; @@ -44,15 +44,15 @@ enum cmd_retval cmd_choose_buffer_exec(struct cmd *self, struct cmd_q *cmdq) { struct args *args = self->args; - struct client *c; + struct client *c = cmdq->state.c; + struct winlink *wl = cmdq->state.tflag.wl; struct window_choose_data *cdata; - struct winlink *wl; struct paste_buffer *pb; char *action, *action_data; const char *template; u_int idx; - if ((c = cmd_find_client(cmdq, NULL, 1)) == NULL) { + if (c == NULL) { cmdq_error(cmdq, "no client available"); return (CMD_RETURN_ERROR); } @@ -60,9 +60,6 @@ cmd_choose_buffer_exec(struct cmd *self, struct cmd_q *cmdq) if ((template = args_get(args, 'F')) == NULL) template = CHOOSE_BUFFER_TEMPLATE; - if ((wl = cmd_find_window(cmdq, args_get(args, 't'), NULL)) == NULL) - return (CMD_RETURN_ERROR); - if (paste_get_top(NULL) == NULL) return (CMD_RETURN_NORMAL); diff --git a/cmd-choose-client.c b/cmd-choose-client.c index 93a141ee..c58bc826 100644 --- a/cmd-choose-client.c +++ b/cmd-choose-client.c @@ -41,7 +41,7 @@ const struct cmd_entry cmd_choose_client_entry = { "choose-client", NULL, "F:t:", 0, 1, CMD_TARGET_WINDOW_USAGE " [-F format] [template]", - 0, + CMD_WINDOW_T, cmd_choose_client_exec }; @@ -53,22 +53,19 @@ enum cmd_retval cmd_choose_client_exec(struct cmd *self, struct cmd_q *cmdq) { struct args *args = self->args; - struct client *c; + struct client *c = cmdq->state.c; struct client *c1; struct window_choose_data *cdata; - struct winlink *wl; + struct winlink *wl = cmdq->state.tflag.wl; const char *template; char *action; u_int idx, cur; - if ((c = cmd_find_client(cmdq, NULL, 1)) == NULL) { + if (c == NULL) { cmdq_error(cmdq, "no client available"); return (CMD_RETURN_ERROR); } - if ((wl = cmd_find_window(cmdq, args_get(args, 't'), NULL)) == NULL) - return (CMD_RETURN_ERROR); - if (window_pane_set_mode(wl->window->active, &window_choose_mode) != 0) return (CMD_RETURN_NORMAL); diff --git a/cmd-choose-tree.c b/cmd-choose-tree.c index 0b0fea6a..766978fe 100644 --- a/cmd-choose-tree.c +++ b/cmd-choose-tree.c @@ -48,7 +48,7 @@ const struct cmd_entry cmd_choose_tree_entry = { "S:W:swub:c:t:", 0, 1, "[-suw] [-b session-template] [-c window template] [-S format] " \ "[-W format] " CMD_TARGET_WINDOW_USAGE, - 0, + CMD_WINDOW_T, cmd_choose_tree_exec }; @@ -56,7 +56,7 @@ const struct cmd_entry cmd_choose_session_entry = { "choose-session", NULL, "F:t:", 0, 1, CMD_TARGET_WINDOW_USAGE " [-F format] [template]", - 0, + CMD_WINDOW_T, cmd_choose_tree_exec }; @@ -64,7 +64,7 @@ const struct cmd_entry cmd_choose_window_entry = { "choose-window", NULL, "F:t:", 0, 1, CMD_TARGET_WINDOW_USAGE "[-F format] [template]", - 0, + CMD_WINDOW_T, cmd_choose_tree_exec }; @@ -72,9 +72,9 @@ enum cmd_retval cmd_choose_tree_exec(struct cmd *self, struct cmd_q *cmdq) { struct args *args = self->args; - struct winlink *wl, *wm; - struct session *s, *s2; - struct client *c; + struct client *c = cmdq->state.c; + struct winlink *wl = cmdq->state.tflag.wl, *wm; + struct session *s = cmdq->state.tflag.s, *s2; struct window_choose_data *wcd = NULL; const char *ses_template, *win_template; char *final_win_action, *cur_win_template; @@ -87,14 +87,11 @@ cmd_choose_tree_exec(struct cmd *self, struct cmd_q *cmdq) ses_template = win_template = NULL; ses_action = win_action = NULL; - if ((c = cmd_find_client(cmdq, NULL, 1)) == NULL) { + if (c == NULL) { cmdq_error(cmdq, "no client available"); return (CMD_RETURN_ERROR); } - if ((wl = cmd_find_window(cmdq, args_get(args, 't'), &s)) == NULL) - return (CMD_RETURN_ERROR); - if (window_pane_set_mode(wl->window->active, &window_choose_mode) != 0) return (CMD_RETURN_NORMAL); diff --git a/cmd-clear-history.c b/cmd-clear-history.c index 63e9d548..a76cab80 100644 --- a/cmd-clear-history.c +++ b/cmd-clear-history.c @@ -30,20 +30,17 @@ const struct cmd_entry cmd_clear_history_entry = { "clear-history", "clearhist", "t:", 0, 0, CMD_TARGET_PANE_USAGE, - 0, + CMD_PANE_T, cmd_clear_history_exec }; enum cmd_retval -cmd_clear_history_exec(struct cmd *self, struct cmd_q *cmdq) +cmd_clear_history_exec(__unused struct cmd *self, struct cmd_q *cmdq) { - struct args *args = self->args; - struct window_pane *wp; + struct window_pane *wp = cmdq->state.tflag.wp; struct grid *gd; - if (cmd_find_pane(cmdq, args_get(args, 't'), NULL, &wp) == NULL) - return (CMD_RETURN_ERROR); - gd = wp->base.grid; + gd = cmdq->state.tflag.wp->base.grid; if (wp->mode == &window_copy_mode) window_pane_reset_mode(wp); diff --git a/cmd-command-prompt.c b/cmd-command-prompt.c index 1622e0b7..900fceb9 100644 --- a/cmd-command-prompt.c +++ b/cmd-command-prompt.c @@ -38,7 +38,7 @@ const struct cmd_entry cmd_command_prompt_entry = { "command-prompt", NULL, "I:p:t:", 0, 1, "[-I inputs] [-p prompts] " CMD_TARGET_CLIENT_USAGE " [template]", - 0, + CMD_CLIENT_T, cmd_command_prompt_exec }; @@ -58,13 +58,10 @@ cmd_command_prompt_exec(struct cmd *self, struct cmd_q *cmdq) struct args *args = self->args; const char *inputs, *prompts; struct cmd_command_prompt_cdata *cdata; - struct client *c; + struct client *c = cmdq->state.c; char *prompt, *ptr, *input = NULL; size_t n; - if ((c = cmd_find_client(cmdq, args_get(args, 't'), 0)) == NULL) - return (CMD_RETURN_ERROR); - if (c->prompt_string != NULL) return (CMD_RETURN_NORMAL); diff --git a/cmd-confirm-before.c b/cmd-confirm-before.c index 248515cd..17a575a2 100644 --- a/cmd-confirm-before.c +++ b/cmd-confirm-before.c @@ -37,7 +37,7 @@ const struct cmd_entry cmd_confirm_before_entry = { "confirm-before", "confirm", "p:t:", 1, 1, "[-p prompt] " CMD_TARGET_CLIENT_USAGE " command", - 0, + CMD_CLIENT_T, cmd_confirm_before_exec }; @@ -51,13 +51,10 @@ cmd_confirm_before_exec(struct cmd *self, struct cmd_q *cmdq) { struct args *args = self->args; struct cmd_confirm_before_data *cdata; - struct client *c; + struct client *c = cmdq->state.c; char *cmd, *copy, *new_prompt, *ptr; const char *prompt; - if ((c = cmd_find_client(cmdq, args_get(args, 't'), 0)) == NULL) - return (CMD_RETURN_ERROR); - if ((prompt = args_get(args, 'p')) != NULL) xasprintf(&new_prompt, "%s ", prompt); else { diff --git a/cmd-copy-mode.c b/cmd-copy-mode.c index e04b561b..79d06cee 100644 --- a/cmd-copy-mode.c +++ b/cmd-copy-mode.c @@ -29,8 +29,8 @@ enum cmd_retval cmd_copy_mode_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_copy_mode_entry = { "copy-mode", NULL, "Met:u", 0, 0, - "[-Meu] " CMD_TARGET_PANE_USAGE, - 0, + "[-Mu] " CMD_TARGET_PANE_USAGE, + CMD_PANE_T, cmd_copy_mode_exec }; @@ -48,15 +48,14 @@ cmd_copy_mode_exec(struct cmd *self, struct cmd_q *cmdq) struct args *args = self->args; struct client *c = cmdq->client; struct session *s; - struct window_pane *wp; + struct window_pane *wp = cmdq->state.tflag.wp; if (args_has(args, 'M')) { if ((wp = cmd_mouse_pane(&cmdq->item->mouse, &s, NULL)) == NULL) return (CMD_RETURN_NORMAL); if (c == NULL || c->session != s) return (CMD_RETURN_NORMAL); - } else if (cmd_find_pane(cmdq, args_get(args, 't'), NULL, &wp) == NULL) - return (CMD_RETURN_ERROR); + } if (self->entry == &cmd_clock_mode_entry) { window_pane_set_mode(wp, &window_clock_mode); diff --git a/cmd-detach-client.c b/cmd-detach-client.c index d8128eae..86f8063c 100644 --- a/cmd-detach-client.c +++ b/cmd-detach-client.c @@ -31,8 +31,8 @@ enum cmd_retval cmd_detach_client_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_detach_client_entry = { "detach-client", "detach", "as:t:P", 0, 0, - "[-aP] [-s target-session] " CMD_TARGET_CLIENT_USAGE, - CMD_READONLY, + "[-P] [-a] [-s target-session] " CMD_TARGET_CLIENT_USAGE, + CMD_READONLY|CMD_CLIENT_T|CMD_SESSION_S, cmd_detach_client_exec }; @@ -40,7 +40,7 @@ const struct cmd_entry cmd_suspend_client_entry = { "suspend-client", "suspendc", "t:", 0, 0, CMD_TARGET_CLIENT_USAGE, - 0, + CMD_CLIENT_T, cmd_detach_client_exec }; @@ -48,13 +48,11 @@ enum cmd_retval cmd_detach_client_exec(struct cmd *self, struct cmd_q *cmdq) { struct args *args = self->args; - struct client *c, *cloop; + struct client *c = cmdq->state.c, *cloop; struct session *s; enum msgtype msgtype; if (self->entry == &cmd_suspend_client_entry) { - if ((c = cmd_find_client(cmdq, args_get(args, 't'), 0)) == NULL) - return (CMD_RETURN_ERROR); tty_stop_tty(&c->tty); c->flags |= CLIENT_SUSPENDED; proc_send(c->peer, MSG_SUSPEND, -1, NULL, 0); @@ -67,10 +65,7 @@ cmd_detach_client_exec(struct cmd *self, struct cmd_q *cmdq) msgtype = MSG_DETACH; if (args_has(args, 's')) { - s = cmd_find_session(cmdq, args_get(args, 's'), 0); - if (s == NULL) - return (CMD_RETURN_ERROR); - + s = cmdq->state.sflag.s; TAILQ_FOREACH(cloop, &clients, entry) { if (cloop->session == s) server_client_detach(cloop, msgtype); @@ -78,10 +73,6 @@ cmd_detach_client_exec(struct cmd *self, struct cmd_q *cmdq) return (CMD_RETURN_STOP); } - c = cmd_find_client(cmdq, args_get(args, 't'), 0); - if (c == NULL) - return (CMD_RETURN_ERROR); - if (args_has(args, 'a')) { TAILQ_FOREACH(cloop, &clients, entry) { if (cloop->session != NULL && cloop != c) diff --git a/cmd-display-message.c b/cmd-display-message.c index 7ca8e9c4..201f8b75 100644 --- a/cmd-display-message.c +++ b/cmd-display-message.c @@ -39,7 +39,7 @@ const struct cmd_entry cmd_display_message_entry = { "c:pt:F:", 0, 1, "[-p] [-c target-client] [-F format] " CMD_TARGET_PANE_USAGE " [message]", - 0, + CMD_CLIENT_C|CMD_PANE_T, cmd_display_message_exec }; @@ -47,41 +47,19 @@ enum cmd_retval cmd_display_message_exec(struct cmd *self, struct cmd_q *cmdq) { struct args *args = self->args; - struct client *c; - struct session *s; - struct winlink *wl; - struct window_pane *wp; + struct client *c = cmdq->state.c; + struct session *s = cmdq->state.tflag.s; + struct winlink *wl = cmdq->state.tflag.wl; + struct window_pane *wp = cmdq->state.tflag.wp; const char *template; char *msg; struct format_tree *ft; - if (args_has(args, 't')) { - wl = cmd_find_pane(cmdq, args_get(args, 't'), &s, &wp); - if (wl == NULL) - return (CMD_RETURN_ERROR); - } else { - wl = cmd_find_pane(cmdq, NULL, &s, &wp); - if (wl == NULL) - return (CMD_RETURN_ERROR); - } - if (args_has(args, 'F') && args->argc != 0) { cmdq_error(cmdq, "only one of -F or argument must be given"); return (CMD_RETURN_ERROR); } - if (args_has(args, 'c')) { - c = cmd_find_client(cmdq, args_get(args, 'c'), 0); - if (c == NULL) - return (CMD_RETURN_ERROR); - } else { - c = cmd_find_client(cmdq, NULL, 1); - if (c == NULL && !args_has(self->args, 'p')) { - cmdq_error(cmdq, "no client available"); - return (CMD_RETURN_ERROR); - } - } - template = args_get(args, 'F'); if (args->argc != 0) template = args->argv[0]; diff --git a/cmd-display-panes.c b/cmd-display-panes.c index 9ce89712..714ee19e 100644 --- a/cmd-display-panes.c +++ b/cmd-display-panes.c @@ -30,20 +30,14 @@ const struct cmd_entry cmd_display_panes_entry = { "display-panes", "displayp", "t:", 0, 0, CMD_TARGET_CLIENT_USAGE, - 0, + CMD_CLIENT_T, cmd_display_panes_exec }; enum cmd_retval -cmd_display_panes_exec(struct cmd *self, struct cmd_q *cmdq) +cmd_display_panes_exec(__unused struct cmd *self, struct cmd_q *cmdq) { - struct args *args = self->args; - struct client *c; - - if ((c = cmd_find_client(cmdq, args_get(args, 't'), 0)) == NULL) - return (CMD_RETURN_ERROR); - - server_set_identify(c); + server_set_identify(cmdq->state.c); return (CMD_RETURN_NORMAL); } diff --git a/cmd-find-window.c b/cmd-find-window.c index e92ae60f..1733b717 100644 --- a/cmd-find-window.c +++ b/cmd-find-window.c @@ -51,7 +51,7 @@ const struct cmd_entry cmd_find_window_entry = { "find-window", "findw", "F:CNt:T", 1, 4, "[-CNT] [-F format] " CMD_TARGET_WINDOW_USAGE " match-string", - 0, + CMD_WINDOW_T, cmd_find_window_exec }; @@ -137,10 +137,10 @@ enum cmd_retval cmd_find_window_exec(struct cmd *self, struct cmd_q *cmdq) { struct args *args = self->args; - struct client *c; + struct client *c = cmdq->state.c; struct window_choose_data *cdata; - struct session *s; - struct winlink *wl, *wm; + struct session *s = cmdq->state.tflag.s; + struct winlink *wl = cmdq->state.tflag.wl, *wm; struct cmd_find_window_list find_list; struct cmd_find_window_data *find_data; struct cmd_find_window_data *find_data1; @@ -148,14 +148,10 @@ cmd_find_window_exec(struct cmd *self, struct cmd_q *cmdq) const char *template; u_int i, match_flags; - if ((c = cmd_find_client(cmdq, NULL, 1)) == NULL) { + if (c == NULL) { cmdq_error(cmdq, "no client available"); return (CMD_RETURN_ERROR); } - s = c->session; - - if ((wl = cmd_find_window(cmdq, args_get(args, 't'), NULL)) == NULL) - return (CMD_RETURN_ERROR); if ((template = args_get(args, 'F')) == NULL) template = FIND_WINDOW_TEMPLATE; diff --git a/cmd-if-shell.c b/cmd-if-shell.c index 3345e8ce..404f4671 100644 --- a/cmd-if-shell.c +++ b/cmd-if-shell.c @@ -39,7 +39,7 @@ const struct cmd_entry cmd_if_shell_entry = { "if-shell", "if", "bFt:", 2, 3, "[-bF] " CMD_TARGET_PANE_USAGE " shell-command command [command]", - 0, + CMD_PANE_T|CMD_CANFAIL, cmd_if_shell_exec }; @@ -61,31 +61,20 @@ cmd_if_shell_exec(struct cmd *self, struct cmd_q *cmdq) struct cmd_if_shell_data *cdata; char *shellcmd, *cmd, *cause; struct cmd_list *cmdlist; - struct client *c; - struct session *s = NULL; - struct winlink *wl = NULL; - struct window_pane *wp = NULL; + struct session *s = cmdq->state.tflag.s; + struct winlink *wl = cmdq->state.tflag.wl; + struct window_pane *wp = cmdq->state.tflag.wp; struct format_tree *ft; const char *cwd; - if (args_has(args, 't')) { - wl = cmd_find_pane(cmdq, args_get(args, 't'), &s, &wp); - cwd = wp->cwd; - } else { - c = cmd_find_client(cmdq, NULL, 1); - if (c != NULL && c->session != NULL) { - s = c->session; - wl = s->curw; - wp = wl->window->active; - } - if (cmdq->client != NULL && cmdq->client->session == NULL) - cwd = cmdq->client->cwd; - else if (s != NULL) - cwd = s->cwd; - else - cwd = NULL; - } + cwd = wp->cwd; + if (cmdq->client != NULL && cmdq->client->session == NULL) + cwd = cmdq->client->cwd; + else if (s != NULL) + cwd = s->cwd; + else + cwd = NULL; ft = format_create(cmdq, 0); format_defaults(ft, NULL, s, wl, wp); shellcmd = format_expand(ft, args->argv[0]); diff --git a/cmd-join-pane.c b/cmd-join-pane.c index cc6432a4..6fc5b977 100644 --- a/cmd-join-pane.c +++ b/cmd-join-pane.c @@ -37,7 +37,7 @@ const struct cmd_entry cmd_join_pane_entry = { "join-pane", "joinp", "bdhvp:l:s:t:", 0, 0, "[-bdhv] [-p percentage|-l size] " CMD_SRCDST_PANE_USAGE, - 0, + CMD_PANE_MARKED_S|CMD_PANE_T, cmd_join_pane_exec }; @@ -45,7 +45,7 @@ const struct cmd_entry cmd_move_pane_entry = { |