mirror of
https://github.com/tmux/tmux.git
synced 2024-12-04 19:58:48 +00:00
Merge branch 'obsd-master'
This commit is contained in:
commit
e802b683ea
@ -40,20 +40,23 @@ const struct cmd_entry cmd_attach_session_entry = {
|
||||
.args = { "c:dErt:", 0, 0 },
|
||||
.usage = "[-dEr] [-c working-directory] " CMD_TARGET_SESSION_USAGE,
|
||||
|
||||
.tflag = CMD_SESSION_WITHPANE,
|
||||
/* -t is special */
|
||||
|
||||
.flags = CMD_STARTSERVER,
|
||||
.exec = cmd_attach_session_exec
|
||||
};
|
||||
|
||||
enum cmd_retval
|
||||
cmd_attach_session(struct cmdq_item *item, int dflag, int rflag,
|
||||
const char *cflag, int Eflag)
|
||||
cmd_attach_session(struct cmdq_item *item, const char *tflag, int dflag,
|
||||
int rflag, const char *cflag, int Eflag)
|
||||
{
|
||||
struct session *s = item->state.tflag.s;
|
||||
struct cmd_find_state *current = &item->shared->current;
|
||||
enum cmd_find_type type;
|
||||
int flags;
|
||||
struct client *c = item->client, *c_loop;
|
||||
struct winlink *wl = item->state.tflag.wl;
|
||||
struct window_pane *wp = item->state.tflag.wp;
|
||||
struct session *s;
|
||||
struct winlink *wl;
|
||||
struct window_pane *wp;
|
||||
char *cause;
|
||||
|
||||
if (RB_EMPTY(&sessions)) {
|
||||
@ -69,10 +72,27 @@ cmd_attach_session(struct cmdq_item *item, int dflag, int rflag,
|
||||
return (CMD_RETURN_ERROR);
|
||||
}
|
||||
|
||||
if (tflag != NULL && tflag[strcspn(tflag, ":.")] != '\0') {
|
||||
type = CMD_FIND_PANE;
|
||||
flags = 0;
|
||||
} else {
|
||||
type = CMD_FIND_SESSION;
|
||||
flags = CMD_FIND_PREFER_UNATTACHED;
|
||||
}
|
||||
if (cmd_find_target(&item->target, item, tflag, type, flags) != 0)
|
||||
return (CMD_RETURN_ERROR);
|
||||
s = item->target.s;
|
||||
wl = item->target.wl;
|
||||
wp = item->target.wp;
|
||||
|
||||
if (wl != NULL) {
|
||||
if (wp != NULL)
|
||||
window_set_active_pane(wp->window, wp);
|
||||
session_set_current(s, wl);
|
||||
if (wp != NULL)
|
||||
cmd_find_from_winlink_pane(current, wl, wp);
|
||||
else
|
||||
cmd_find_from_winlink(current, wl);
|
||||
}
|
||||
|
||||
if (cflag != NULL) {
|
||||
@ -145,6 +165,7 @@ cmd_attach_session_exec(struct cmd *self, struct cmdq_item *item)
|
||||
{
|
||||
struct args *args = self->args;
|
||||
|
||||
return (cmd_attach_session(item, args_has(args, 'd'),
|
||||
args_has(args, 'r'), args_get(args, 'c'), args_has(args, 'E')));
|
||||
return (cmd_attach_session(item, args_get(args, 't'),
|
||||
args_has(args, 'd'), args_has(args, 'r'), args_get(args, 'c'),
|
||||
args_has(args, 'E')));
|
||||
}
|
||||
|
@ -35,10 +35,11 @@ const struct cmd_entry cmd_break_pane_entry = {
|
||||
.alias = "breakp",
|
||||
|
||||
.args = { "dPF:n:s:t:", 0, 0 },
|
||||
.usage = "[-dP] [-F format] [-n window-name] [-s src-pane] [-t dst-window]",
|
||||
.usage = "[-dP] [-F format] [-n window-name] [-s src-pane] "
|
||||
"[-t dst-window]",
|
||||
|
||||
.sflag = CMD_PANE,
|
||||
.tflag = CMD_WINDOW_INDEX,
|
||||
.source = { 's', CMD_FIND_PANE, 0 },
|
||||
.target = { 't', CMD_FIND_WINDOW, CMD_FIND_WINDOW_INDEX },
|
||||
|
||||
.flags = 0,
|
||||
.exec = cmd_break_pane_exec
|
||||
@ -48,14 +49,15 @@ static enum cmd_retval
|
||||
cmd_break_pane_exec(struct cmd *self, struct cmdq_item *item)
|
||||
{
|
||||
struct args *args = self->args;
|
||||
struct client *c = item->state.c;
|
||||
struct winlink *wl = item->state.sflag.wl;
|
||||
struct session *src_s = item->state.sflag.s;
|
||||
struct session *dst_s = item->state.tflag.s;
|
||||
struct window_pane *wp = item->state.sflag.wp;
|
||||
struct cmd_find_state *current = &item->shared->current;
|
||||
struct client *c = cmd_find_client(item, NULL, 1);
|
||||
struct winlink *wl = item->source.wl;
|
||||
struct session *src_s = item->source.s;
|
||||
struct session *dst_s = item->target.s;
|
||||
struct window_pane *wp = item->source.wp;
|
||||
struct window *w = wl->window;
|
||||
char *name, *cause;
|
||||
int idx = item->state.tflag.idx;
|
||||
int idx = item->target.idx;
|
||||
const char *template;
|
||||
char *cp;
|
||||
|
||||
@ -93,8 +95,10 @@ cmd_break_pane_exec(struct cmd *self, struct cmdq_item *item)
|
||||
if (idx == -1)
|
||||
idx = -1 - options_get_number(dst_s->options, "base-index");
|
||||
wl = session_attach(dst_s, w, idx, &cause); /* can't fail */
|
||||
if (!args_has(self->args, 'd'))
|
||||
if (!args_has(self->args, 'd')) {
|
||||
session_select(dst_s, wl->idx);
|
||||
cmd_find_from_session(current, dst_s);
|
||||
}
|
||||
|
||||
server_redraw_session(src_s);
|
||||
if (src_s != dst_s)
|
||||
|
@ -43,7 +43,7 @@ const struct cmd_entry cmd_capture_pane_entry = {
|
||||
.usage = "[-aCeJpPq] " CMD_BUFFER_USAGE " [-E end-line] "
|
||||
"[-S start-line]" CMD_TARGET_PANE_USAGE,
|
||||
|
||||
.tflag = CMD_PANE,
|
||||
.target = { 't', CMD_FIND_PANE, 0 },
|
||||
|
||||
.flags = CMD_AFTERHOOK,
|
||||
.exec = cmd_capture_pane_exec
|
||||
@ -56,7 +56,7 @@ const struct cmd_entry cmd_clear_history_entry = {
|
||||
.args = { "t:", 0, 0 },
|
||||
.usage = CMD_TARGET_PANE_USAGE,
|
||||
|
||||
.tflag = CMD_PANE,
|
||||
.target = { 't', CMD_FIND_PANE, 0 },
|
||||
|
||||
.flags = CMD_AFTERHOOK,
|
||||
.exec = cmd_capture_pane_exec
|
||||
@ -193,7 +193,7 @@ cmd_capture_pane_exec(struct cmd *self, struct cmdq_item *item)
|
||||
{
|
||||
struct args *args = self->args;
|
||||
struct client *c;
|
||||
struct window_pane *wp = item->state.tflag.wp;
|
||||
struct window_pane *wp = item->target.wp;
|
||||
char *buf, *cause;
|
||||
const char *bufname;
|
||||
size_t len;
|
||||
|
@ -40,7 +40,7 @@ const struct cmd_entry cmd_choose_buffer_entry = {
|
||||
.args = { "F:t:", 0, 1 },
|
||||
.usage = CMD_TARGET_WINDOW_USAGE " [-F format] [template]",
|
||||
|
||||
.tflag = CMD_WINDOW,
|
||||
.target = { 't', CMD_FIND_WINDOW, 0 },
|
||||
|
||||
.flags = 0,
|
||||
.exec = cmd_choose_buffer_exec
|
||||
@ -50,8 +50,8 @@ static enum cmd_retval
|
||||
cmd_choose_buffer_exec(struct cmd *self, struct cmdq_item *item)
|
||||
{
|
||||
struct args *args = self->args;
|
||||
struct client *c = item->state.c;
|
||||
struct winlink *wl = item->state.tflag.wl;
|
||||
struct client *c = cmd_find_client(item, NULL, 1);
|
||||
struct winlink *wl = item->target.wl;
|
||||
struct window_choose_data *cdata;
|
||||
struct paste_buffer *pb;
|
||||
char *action, *action_data;
|
||||
|
@ -45,7 +45,7 @@ const struct cmd_entry cmd_choose_client_entry = {
|
||||
.args = { "F:t:", 0, 1 },
|
||||
.usage = CMD_TARGET_WINDOW_USAGE " [-F format] [template]",
|
||||
|
||||
.tflag = CMD_WINDOW,
|
||||
.target = { 't', CMD_FIND_WINDOW, 0 },
|
||||
|
||||
.flags = 0,
|
||||
.exec = cmd_choose_client_exec
|
||||
@ -59,10 +59,10 @@ static enum cmd_retval
|
||||
cmd_choose_client_exec(struct cmd *self, struct cmdq_item *item)
|
||||
{
|
||||
struct args *args = self->args;
|
||||
struct client *c = item->state.c;
|
||||
struct client *c = cmd_find_client(item, NULL, 1);
|
||||
struct client *c1;
|
||||
struct window_choose_data *cdata;
|
||||
struct winlink *wl = item->state.tflag.wl;
|
||||
struct winlink *wl = item->target.wl;
|
||||
const char *template;
|
||||
char *action;
|
||||
u_int idx, cur;
|
||||
|
@ -51,7 +51,7 @@ const struct cmd_entry cmd_choose_tree_entry = {
|
||||
.usage = "[-suw] [-b session-template] [-c window template] "
|
||||
"[-S format] [-W format] " CMD_TARGET_WINDOW_USAGE,
|
||||
|
||||
.tflag = CMD_WINDOW,
|
||||
.target = { 't', CMD_FIND_WINDOW, 0 },
|
||||
|
||||
.flags = 0,
|
||||
.exec = cmd_choose_tree_exec
|
||||
@ -64,7 +64,7 @@ const struct cmd_entry cmd_choose_session_entry = {
|
||||
.args = { "F:t:", 0, 1 },
|
||||
.usage = CMD_TARGET_WINDOW_USAGE " [-F format] [template]",
|
||||
|
||||
.tflag = CMD_WINDOW,
|
||||
.target = { 't', CMD_FIND_WINDOW, 0 },
|
||||
|
||||
.flags = 0,
|
||||
.exec = cmd_choose_tree_exec
|
||||
@ -77,7 +77,7 @@ const struct cmd_entry cmd_choose_window_entry = {
|
||||
.args = { "F:t:", 0, 1 },
|
||||
.usage = CMD_TARGET_WINDOW_USAGE "[-F format] [template]",
|
||||
|
||||
.tflag = CMD_WINDOW,
|
||||
.target = { 't', CMD_FIND_WINDOW, 0 },
|
||||
|
||||
.flags = 0,
|
||||
.exec = cmd_choose_tree_exec
|
||||
@ -87,9 +87,9 @@ static enum cmd_retval
|
||||
cmd_choose_tree_exec(struct cmd *self, struct cmdq_item *item)
|
||||
{
|
||||
struct args *args = self->args;
|
||||
struct client *c = item->state.c;
|
||||
struct winlink *wl = item->state.tflag.wl, *wm;
|
||||
struct session *s = item->state.tflag.s, *s2;
|
||||
struct client *c = cmd_find_client(item, NULL, 1);
|
||||
struct winlink *wl = item->target.wl, *wm;
|
||||
struct session *s = item->target.s, *s2;
|
||||
struct window_choose_data *wcd = NULL;
|
||||
const char *ses_template, *win_template;
|
||||
char *final_win_action, *cur_win_template;
|
||||
|
@ -43,8 +43,6 @@ const struct cmd_entry cmd_command_prompt_entry = {
|
||||
.usage = "[-1Ni] [-I inputs] [-p prompts] " CMD_TARGET_CLIENT_USAGE " "
|
||||
"[template]",
|
||||
|
||||
.tflag = CMD_CLIENT,
|
||||
|
||||
.flags = 0,
|
||||
.exec = cmd_command_prompt_exec
|
||||
};
|
||||
@ -69,10 +67,13 @@ cmd_command_prompt_exec(struct cmd *self, struct cmdq_item *item)
|
||||
struct args *args = self->args;
|
||||
const char *inputs, *prompts;
|
||||
struct cmd_command_prompt_cdata *cdata;
|
||||
struct client *c = item->state.c;
|
||||
struct client *c;
|
||||
char *prompt, *ptr, *input = NULL;
|
||||
size_t n;
|
||||
|
||||
if ((c = cmd_find_client(item, args_get(args, 't'), 0)) == NULL)
|
||||
return (CMD_RETURN_ERROR);
|
||||
|
||||
if (c->prompt_string != NULL)
|
||||
return (CMD_RETURN_NORMAL);
|
||||
|
||||
|
@ -41,8 +41,6 @@ const struct cmd_entry cmd_confirm_before_entry = {
|
||||
.args = { "p:t:", 1, 1 },
|
||||
.usage = "[-p prompt] " CMD_TARGET_CLIENT_USAGE " command",
|
||||
|
||||
.tflag = CMD_CLIENT,
|
||||
|
||||
.flags = 0,
|
||||
.exec = cmd_confirm_before_exec
|
||||
};
|
||||
@ -57,10 +55,13 @@ cmd_confirm_before_exec(struct cmd *self, struct cmdq_item *item)
|
||||
{
|
||||
struct args *args = self->args;
|
||||
struct cmd_confirm_before_data *cdata;
|
||||
struct client *c = item->state.c;
|
||||
struct client *c;
|
||||
char *cmd, *copy, *new_prompt, *ptr;
|
||||
const char *prompt;
|
||||
|
||||
if ((c = cmd_find_client(item, args_get(args, 't'), 0)) == NULL)
|
||||
return (CMD_RETURN_ERROR);
|
||||
|
||||
if ((prompt = args_get(args, 'p')) != NULL)
|
||||
xasprintf(&new_prompt, "%s ", prompt);
|
||||
else {
|
||||
|
@ -33,7 +33,7 @@ const struct cmd_entry cmd_copy_mode_entry = {
|
||||
.args = { "Met:u", 0, 0 },
|
||||
.usage = "[-Mu] " CMD_TARGET_PANE_USAGE,
|
||||
|
||||
.tflag = CMD_PANE,
|
||||
.target = { 't', CMD_FIND_PANE, 0 },
|
||||
|
||||
.flags = CMD_AFTERHOOK,
|
||||
.exec = cmd_copy_mode_exec
|
||||
@ -46,7 +46,7 @@ const struct cmd_entry cmd_clock_mode_entry = {
|
||||
.args = { "t:", 0, 0 },
|
||||
.usage = CMD_TARGET_PANE_USAGE,
|
||||
|
||||
.tflag = CMD_PANE,
|
||||
.target = { 't', CMD_FIND_PANE, 0 },
|
||||
|
||||
.flags = CMD_AFTERHOOK,
|
||||
.exec = cmd_copy_mode_exec
|
||||
@ -59,7 +59,7 @@ cmd_copy_mode_exec(struct cmd *self, struct cmdq_item *item)
|
||||
struct cmdq_shared *shared = item->shared;
|
||||
struct client *c = item->client;
|
||||
struct session *s;
|
||||
struct window_pane *wp = item->state.tflag.wp;
|
||||
struct window_pane *wp = item->target.wp;
|
||||
|
||||
if (args_has(args, 'M')) {
|
||||
if ((wp = cmd_mouse_pane(&shared->mouse, &s, NULL)) == NULL)
|
||||
|
@ -37,8 +37,7 @@ const struct cmd_entry cmd_detach_client_entry = {
|
||||
.usage = "[-aP] [-E shell-command] "
|
||||
"[-s target-session] " CMD_TARGET_CLIENT_USAGE,
|
||||
|
||||
.sflag = CMD_SESSION,
|
||||
.tflag = CMD_CLIENT,
|
||||
.source = { 's', CMD_FIND_SESSION, CMD_FIND_CANFAIL },
|
||||
|
||||
.flags = CMD_READONLY,
|
||||
.exec = cmd_detach_client_exec
|
||||
@ -51,8 +50,6 @@ const struct cmd_entry cmd_suspend_client_entry = {
|
||||
.args = { "t:", 0, 0 },
|
||||
.usage = CMD_TARGET_CLIENT_USAGE,
|
||||
|
||||
.tflag = CMD_CLIENT,
|
||||
|
||||
.flags = 0,
|
||||
.exec = cmd_detach_client_exec
|
||||
};
|
||||
@ -61,11 +58,14 @@ static enum cmd_retval
|
||||
cmd_detach_client_exec(struct cmd *self, struct cmdq_item *item)
|
||||
{
|
||||
struct args *args = self->args;
|
||||
struct client *c = item->state.c, *cloop;
|
||||
struct client *c, *cloop;
|
||||
struct session *s;
|
||||
enum msgtype msgtype;
|
||||
const char *cmd = args_get(args, 'E');
|
||||
|
||||
if ((c = cmd_find_client(item, args_get(args, 't'), 0)) == NULL)
|
||||
return (CMD_RETURN_ERROR);
|
||||
|
||||
if (self->entry == &cmd_suspend_client_entry) {
|
||||
server_client_suspend(c);
|
||||
return (CMD_RETURN_NORMAL);
|
||||
@ -77,7 +77,9 @@ cmd_detach_client_exec(struct cmd *self, struct cmdq_item *item)
|
||||
msgtype = MSG_DETACH;
|
||||
|
||||
if (args_has(args, 's')) {
|
||||
s = item->state.sflag.s;
|
||||
s = item->source.s;
|
||||
if (s == NULL)
|
||||
return (CMD_RETURN_NORMAL);
|
||||
TAILQ_FOREACH(cloop, &clients, entry) {
|
||||
if (cloop->session == s) {
|
||||
if (cmd != NULL)
|
||||
|
@ -43,8 +43,7 @@ const struct cmd_entry cmd_display_message_entry = {
|
||||
.usage = "[-p] [-c target-client] [-F format] "
|
||||
CMD_TARGET_PANE_USAGE " [message]",
|
||||
|
||||
.cflag = CMD_CLIENT_CANFAIL,
|
||||
.tflag = CMD_PANE,
|
||||
.target = { 't', CMD_FIND_PANE, 0 },
|
||||
|
||||
.flags = CMD_AFTERHOOK,
|
||||
.exec = cmd_display_message_exec
|
||||
@ -54,10 +53,10 @@ static enum cmd_retval
|
||||
cmd_display_message_exec(struct cmd *self, struct cmdq_item *item)
|
||||
{
|
||||
struct args *args = self->args;
|
||||
struct client *c = item->state.c;
|
||||
struct session *s = item->state.tflag.s;
|
||||
struct winlink *wl = item->state.tflag.wl;
|
||||
struct window_pane *wp = item->state.tflag.wp;
|
||||
struct client *c;
|
||||
struct session *s = item->target.s;
|
||||
struct winlink *wl = item->target.wl;
|
||||
struct window_pane *wp = item->target.wp;
|
||||
const char *template;
|
||||
char *msg;
|
||||
struct format_tree *ft;
|
||||
@ -66,6 +65,7 @@ cmd_display_message_exec(struct cmd *self, struct cmdq_item *item)
|
||||
cmdq_error(item, "only one of -F or argument must be given");
|
||||
return (CMD_RETURN_ERROR);
|
||||
}
|
||||
c = cmd_find_client(item, args_get(args, 'c'), 1);
|
||||
|
||||
template = args_get(args, 'F');
|
||||
if (args->argc != 0)
|
||||
|
@ -40,8 +40,6 @@ const struct cmd_entry cmd_display_panes_entry = {
|
||||
.args = { "t:", 0, 1 },
|
||||
.usage = CMD_TARGET_CLIENT_USAGE,
|
||||
|
||||
.tflag = CMD_CLIENT,
|
||||
|
||||
.flags = CMD_AFTERHOOK,
|
||||
.exec = cmd_display_panes_exec
|
||||
};
|
||||
@ -50,7 +48,10 @@ static enum cmd_retval
|
||||
cmd_display_panes_exec(struct cmd *self, struct cmdq_item *item)
|
||||
{
|
||||
struct args *args = self->args;
|
||||
struct client *c = item->state.c;
|
||||
struct client *c;
|
||||
|
||||
if ((c = cmd_find_client(item, args_get(args, 't'), 0)) == NULL)
|
||||
return (CMD_RETURN_ERROR);
|
||||
|
||||
if (c->identify_callback != NULL)
|
||||
return (CMD_RETURN_NORMAL);
|
||||
|
@ -54,7 +54,7 @@ const struct cmd_entry cmd_find_window_entry = {
|
||||
.args = { "F:CNt:T", 1, 4 },
|
||||
.usage = "[-CNT] [-F format] " CMD_TARGET_WINDOW_USAGE " match-string",
|
||||
|
||||
.tflag = CMD_WINDOW,
|
||||
.target = { 't', CMD_FIND_WINDOW, 0 },
|
||||
|
||||
.flags = 0,
|
||||
.exec = cmd_find_window_exec
|
||||
@ -142,10 +142,11 @@ static enum cmd_retval
|
||||
cmd_find_window_exec(struct cmd *self, struct cmdq_item *item)
|
||||
{
|
||||
struct args *args = self->args;
|
||||
struct client *c = item->state.c;
|
||||
struct cmd_find_state *current = &item->shared->current;
|
||||
struct client *c = cmd_find_client(item, NULL, 1);
|
||||
struct window_choose_data *cdata;
|
||||
struct session *s = item->state.tflag.s;
|
||||
struct winlink *wl = item->state.tflag.wl, *wm;
|
||||
struct session *s = item->target.s;
|
||||
struct winlink *wl = item->target.wl, *wm;
|
||||
struct cmd_find_window_list find_list;
|
||||
struct cmd_find_window_data *find_data;
|
||||
struct cmd_find_window_data *find_data1;
|
||||
@ -177,8 +178,10 @@ cmd_find_window_exec(struct cmd *self, struct cmdq_item *item)
|
||||
}
|
||||
|
||||
if (TAILQ_NEXT(TAILQ_FIRST(&find_list), entry) == NULL) {
|
||||
if (session_select(s, TAILQ_FIRST(&find_list)->wl->idx) == 0)
|
||||
if (session_select(s, TAILQ_FIRST(&find_list)->wl->idx) == 0) {
|
||||
cmd_find_from_session(current, s);
|
||||
server_redraw_session(s);
|
||||
}
|
||||
recalculate_sizes();
|
||||
goto out;
|
||||
}
|
||||
|
@ -952,6 +952,10 @@ cmd_find_target(struct cmd_find_state *fs, struct cmdq_item *item,
|
||||
const char *session, *window, *pane;
|
||||
int window_only = 0, pane_only = 0;
|
||||
|
||||
/* Can fail flag implies quiet. */
|
||||
if (flags & CMD_FIND_CANFAIL)
|
||||
flags |= CMD_FIND_QUIET;
|
||||
|
||||
/* Log the arguments. */
|
||||
if (target == NULL)
|
||||
log_debug("%s: target none, type %d", __func__, type);
|
||||
@ -1189,6 +1193,8 @@ error:
|
||||
log_debug("%s: error", __func__);
|
||||
|
||||
free(copy);
|
||||
if (flags & CMD_FIND_CANFAIL)
|
||||
return (0);
|
||||
return (-1);
|
||||
|
||||
found:
|
||||
|
@ -43,7 +43,7 @@ const struct cmd_entry cmd_if_shell_entry = {
|
||||
.usage = "[-bF] " CMD_TARGET_PANE_USAGE " shell-command command "
|
||||
"[command]",
|
||||
|
||||
.tflag = CMD_PANE_CANFAIL,
|
||||
.target = { 't', CMD_FIND_PANE, CMD_FIND_CANFAIL },
|
||||
|
||||
.flags = 0,
|
||||
.exec = cmd_if_shell_exec
|
||||
@ -70,10 +70,10 @@ cmd_if_shell_exec(struct cmd *self, struct cmdq_item *item)
|
||||
char *shellcmd, *cmd, *cause;
|
||||
struct cmd_list *cmdlist;
|
||||
struct cmdq_item *new_item;
|
||||
struct client *c = item->state.c;
|
||||
struct session *s = item->state.tflag.s;
|
||||
struct winlink *wl = item->state.tflag.wl;
|
||||
struct window_pane *wp = item->state.tflag.wp;
|
||||
struct client *c = cmd_find_client(item, NULL, 1);
|
||||
struct session *s = item->target.s;
|
||||
struct winlink *wl = item->target.wl;
|
||||
struct window_pane *wp = item->target.wp;
|
||||
const char *cwd;
|
||||
|
||||
if (item->client != NULL && item->client->session == NULL)
|
||||
|
@ -37,8 +37,8 @@ const struct cmd_entry cmd_join_pane_entry = {
|
||||
.args = { "bdhvp:l:s:t:", 0, 0 },
|
||||
.usage = "[-bdhv] [-p percentage|-l size] " CMD_SRCDST_PANE_USAGE,
|
||||
|
||||
.sflag = CMD_PANE_MARKED,
|
||||
.tflag = CMD_PANE,
|
||||
.source = { 's', CMD_FIND_PANE, CMD_FIND_DEFAULT_MARKED },
|
||||
.target = { 't', CMD_FIND_PANE, 0 },
|
||||
|
||||
.flags = 0,
|
||||
.exec = cmd_join_pane_exec
|
||||
@ -51,8 +51,8 @@ const struct cmd_entry cmd_move_pane_entry = {
|
||||
.args = { "bdhvp:l:s:t:", 0, 0 },
|
||||
.usage = "[-bdhv] [-p percentage|-l size] " CMD_SRCDST_PANE_USAGE,
|
||||
|
||||
.sflag = CMD_PANE,
|
||||
.tflag = CMD_PANE,
|
||||
.source = { 's', CMD_FIND_PANE, 0 },
|
||||
.target = { 't', CMD_FIND_PANE, 0 },
|
||||
|
||||
.flags = 0,
|
||||
.exec = cmd_join_pane_exec
|
||||
@ -62,6 +62,7 @@ static enum cmd_retval
|
||||
cmd_join_pane_exec(struct cmd *self, struct cmdq_item *item)
|
||||
{
|
||||
struct args *args = self->args;
|
||||
struct cmd_find_state *current = &item->shared->current;
|
||||
struct session *dst_s;
|
||||
struct winlink *src_wl, *dst_wl;
|
||||
struct window *src_w, *dst_w;
|
||||
@ -77,15 +78,15 @@ cmd_join_pane_exec(struct cmd *self, struct cmdq_item *item)
|
||||
else
|
||||
not_same_window = 0;
|
||||
|
||||
dst_s = item->state.tflag.s;
|
||||
dst_wl = item->state.tflag.wl;
|
||||
dst_wp = item->state.tflag.wp;
|
||||
dst_s = item->target.s;
|
||||
dst_wl = item->target.wl;
|
||||
dst_wp = item->target.wp;
|
||||
dst_w = dst_wl->window;
|
||||
dst_idx = dst_wl->idx;
|
||||
server_unzoom_window(dst_w);
|
||||
|
||||
src_wl = item->state.sflag.wl;
|
||||
src_wp = item->state.sflag.wp;
|
||||
src_wl = item->source.wl;
|
||||
src_wp = item->source.wp;
|
||||
src_w = src_wl->window;
|
||||
server_unzoom_window(src_w);
|
||||
|
||||
@ -145,6 +146,7 @@ cmd_join_pane_exec(struct cmd *self, struct cmdq_item *item)
|
||||
if (!args_has(args, 'd')) {
|
||||
window_set_active_pane(dst_w, src_wp);
|
||||
session_select(dst_s, dst_idx);
|
||||
cmd_find_from_session(current, dst_s);
|
||||
server_redraw_session(dst_s);
|
||||
} else
|
||||
server_status_session(dst_s);
|
||||
|
@ -35,7 +35,7 @@ const struct cmd_entry cmd_kill_pane_entry = {
|
||||
.args = { "at:", 0, 0 },
|
||||
.usage = "[-a] " CMD_TARGET_PANE_USAGE,
|
||||
|
||||
.tflag = CMD_PANE,
|
||||
.target = { 't', CMD_FIND_PANE, 0 },
|
||||
|
||||
.flags = 0,
|
||||
.exec = cmd_kill_pane_exec
|
||||
@ -44,8 +44,8 @@ const struct cmd_entry cmd_kill_pane_entry = {
|
||||
static enum cmd_retval
|
||||
cmd_kill_pane_exec(struct cmd *self, struct cmdq_item *item)
|
||||
{
|
||||
struct winlink *wl = item->state.tflag.wl;
|
||||
struct window_pane *loopwp, *tmpwp, *wp = item->state.tflag.wp;
|
||||
struct winlink *wl = item->target.wl;
|
||||
struct window_pane *loopwp, *tmpwp, *wp = item->target.wp;
|
||||
|
||||
server_unzoom_window(wl->window);
|
||||
|
||||
|
@ -36,7 +36,7 @@ const struct cmd_entry cmd_kill_session_entry = {
|
||||
.args = { "aCt:", 0, 0 },
|
||||
.usage = "[-aC] " CMD_TARGET_SESSION_USAGE,
|
||||
|
||||
.tflag = CMD_SESSION,
|
||||
.target = { 't', CMD_FIND_SESSION, 0 },
|
||||
|
||||
.flags = 0,
|
||||
.exec = cmd_kill_session_exec
|
||||
@ -49,7 +49,7 @@ cmd_kill_session_exec(struct cmd *self, struct cmdq_item *item)
|
||||
struct session *s, *sloop, *stmp;
|
||||
struct winlink *wl;
|
||||
|
||||
s = item->state.tflag.s;
|
||||
s = item->target.s;
|
||||
|
||||
if (args_has(args, 'C')) {
|
||||
RB_FOREACH(wl, winlinks, &s->windows) {
|
||||
|
@ -33,7 +33,7 @@ const struct cmd_entry cmd_kill_window_entry = {
|
||||
.args = { "at:", 0, 0 },
|
||||
.usage = "[-a] " CMD_TARGET_WINDOW_USAGE,
|
||||
|
||||
.tflag = CMD_WINDOW,
|
||||
.target = { 't', CMD_FIND_WINDOW, 0 },
|
||||
|
||||
.flags = 0,
|
||||
.exec = cmd_kill_window_exec
|
||||
@ -46,7 +46,7 @@ const struct cmd_entry cmd_unlink_window_entry = {
|
||||
.args = { "kt:", 0, 0 },
|
||||
.usage = "[-k] " CMD_TARGET_WINDOW_USAGE,
|
||||
|
||||
.tflag = CMD_WINDOW,
|
||||
.target = { 't', CMD_FIND_WINDOW, 0 },
|
||||
|
||||
.flags = 0,
|
||||
.exec = cmd_kill_window_exec
|
||||
@ -56,9 +56,9 @@ static enum cmd_retval
|
||||
cmd_kill_window_exec(struct cmd *self, struct cmdq_item *item)
|
||||
{
|
||||
struct args *args = self->args;
|
||||
struct winlink *wl = item->state.tflag.wl, *wl2, *wl3;
|
||||
struct winlink *wl = item->target.wl, *wl2, *wl3;
|
||||
struct window *w = wl->window;
|
||||
struct session *s = item->state.tflag.s;
|
||||
struct session *s = item->target.s;
|
||||
|
||||
if (self->entry == &cmd_unlink_window_entry) {
|
||||
if (!args_has(self->args, 'k') && !session_is_linked(s, w)) {
|
||||
|
@ -42,7 +42,7 @@ const struct cmd_entry cmd_list_clients_entry = {
|
||||
.args = { "F:t:", 0, 0 },
|
||||
.usage = "[-F format] " CMD_TARGET_SESSION_USAGE,
|
||||
|
||||
.tflag = CMD_SESSION,
|
||||
.target = { 't', CMD_FIND_SESSION, 0 },
|
||||
|
||||
.flags = CMD_READONLY|CMD_AFTERHOOK,
|
||||
.exec = cmd_list_clients_exec
|
||||
@ -60,7 +60,7 @@ cmd_list_clients_exec(struct cmd *self, struct cmdq_item *item)
|
||||
char *line;
|
||||
|
||||
if (args_has(args, 't'))
|
||||
s = item->state.tflag.s;
|
||||
s = item->target.s;
|
||||
else
|
||||
s = NULL;
|
||||
|
||||
|
@ -41,7 +41,7 @@ const struct cmd_entry cmd_list_panes_entry = {
|
||||
.args = { "asF:t:", 0, 0 },
|
||||
.usage = "[-as] [-F format] " CMD_TARGET_WINDOW_USAGE,
|
||||
|
||||
.tflag = CMD_WINDOW,
|
||||
.target = { 't', CMD_FIND_WINDOW, 0 },
|
||||
|
||||
.flags = CMD_AFTERHOOK,
|
||||
.exec = cmd_list_panes_exec
|
||||
@ -51,8 +51,8 @@ static enum cmd_retval
|
||||
cmd_list_panes_exec(struct cmd *self, struct cmdq_item *item)
|
||||
{
|
||||
struct args *args = self->args;
|
||||
struct session *s = item->state.tflag.s;
|
||||
struct winlink *wl = item->state.tflag.wl;
|
||||
struct session *s = item->target.s;
|
||||
struct winlink *wl = item->target.wl;
|
||||
|
||||
if (args_has(args, 'a'))
|
||||
cmd_list_panes_server(self, item);
|
||||
|
@ -52,7 +52,7 @@ const struct cmd_entry cmd_list_windows_entry = {
|
||||
.args = { "F:at:", 0, 0 },
|
||||
.usage = "[-a] [-F format] " CMD_TARGET_SESSION_USAGE,
|
||||
|
||||
.tflag = CMD_SESSION,
|
||||
.target = { 't', CMD_FIND_SESSION, 0 },
|
||||
|
||||
.flags = CMD_AFTERHOOK,
|
||||
.exec = cmd_list_windows_exec
|
||||
@ -66,7 +66,7 @@ cmd_list_windows_exec(struct cmd *self, struct cmdq_item *item)
|
||||
if (args_has(args, 'a'))
|
||||
cmd_list_windows_server(self, item);
|
||||
else
|
||||
cmd_list_windows_session(self, item->state.tflag.s, item, 0);
|
||||
cmd_list_windows_session(self, item->target.s, item, 0);
|
||||
|
||||
return (CMD_RETURN_NORMAL);
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ const struct cmd_entry cmd_lock_session_entry = {
|
||||
.args = { "t:", 0, 0 },
|
||||
.usage = CMD_TARGET_SESSION_USAGE,
|
||||
|
||||
.tflag = CMD_SESSION,
|
||||
.target = { 't', CMD_FIND_SESSION, 0 },
|
||||
|
||||
.flags = CMD_AFTERHOOK,
|
||||
.exec = cmd_lock_server_exec
|
||||
@ -57,22 +57,25 @@ const struct cmd_entry cmd_lock_client_entry = {
|
||||
.args = { "t:", 0, 0 },
|
||||
.usage = CMD_TARGET_CLIENT_USAGE,
|
||||
|
||||
.tflag = CMD_CLIENT,
|
||||
|
||||
.flags = CMD_AFTERHOOK,
|
||||
.exec = cmd_lock_server_exec
|
||||
};
|
||||
|
||||
static enum cmd_retval
|
||||
cmd_lock_server_exec(struct cmd *self, __unused struct cmdq_item *item)
|
||||
cmd_lock_server_exec(struct cmd *self, struct cmdq_item *item)
|
||||
{
|
||||
struct args *args = self->args;
|
||||
struct client *c;
|
||||
|
||||
if (self->entry == &cmd_lock_server_entry)
|
||||
server_lock();
|
||||
else if (self->entry == &cmd_lock_session_entry)
|
||||
server_lock_session(item->state.tflag.s);
|
||||
else
|
||||
server_lock_client(item->state.c);
|
||||
|
||||
server_lock_session(item->target.s);
|
||||
else {
|
||||
if ((c = cmd_find_client(item, args_get(args, 't'), 0)) == NULL)
|
||||
return (CMD_RETURN_ERROR);
|
||||
server_lock_client(c);
|
||||
}
|
||||
recalculate_sizes();
|
||||
|
||||
return (CMD_RETURN_NORMAL);
|
||||
|
@ -35,8 +35,8 @@ const struct cmd_entry cmd_move_window_entry = {
|
||||
.args = { "adkrs:t:", 0, 0 },
|
||||
.usage = "[-dkr] " CMD_SRCDST_WINDOW_USAGE,
|
||||
|
||||
.sflag = CMD_WINDOW,
|
||||
.tflag = CMD_MOVEW_R,
|
||||
.source = { 's', CMD_FIND_WINDOW, 0 },
|
||||
/* -t is special */
|
||||
|
||||
.flags = 0,
|
||||
.exec = cmd_move_window_exec
|
||||
@ -49,8 +49,8 @@ const struct cmd_entry cmd_link_window_entry = {
|
||||
.args = { "adks:t:", 0, 0 },
|
||||
.usage = "[-dk] " CMD_SRCDST_WINDOW_USAGE,
|
||||
|
||||
.sflag = CMD_WINDOW,
|
||||
.tflag = CMD_WINDOW_INDEX,
|
||||
.source = { 's', CMD_FIND_WINDOW, 0 },
|
||||
/* -t is special */
|
||||
|
||||
.flags = 0,
|
||||
.exec = cmd_move_window_exec
|
||||
@ -60,18 +60,31 @@ static enum cmd_retval
|
||||
cmd_move_window_exec(struct cmd *self, struct cmdq_item *item)
|
||||
{
|
||||
struct args *args = self->args;
|
||||
struct session *src = item->state.sflag.s;
|
||||
struct session *dst = item->state.tflag.s;
|
||||
struct winlink *wl = item->state.sflag.wl;
|
||||
const char *tflag = args_get(args, 't');
|
||||
struct session *src;
|
||||
struct session *dst;
|
||||
struct winlink *wl;
|
||||
char *cause;
|
||||
int idx = item->state.tflag.idx, kflag, dflag, sflag;
|
||||
int idx, kflag, dflag, sflag;
|
||||
|
||||
if (args_has(args, 'r')) {
|
||||
session_renumber_windows(dst);
|
||||
if (cmd_find_target(&item->target, item, tflag,
|
||||
CMD_FIND_SESSION, CMD_FIND_QUIET) != 0)
|
||||
return (CMD_RETURN_ERROR);
|
||||
|
||||
session_renumber_windows(item->target.s);
|
||||
recalculate_sizes();
|
||||
server_status_session(item->target.s);
|
||||
|
||||
return (CMD_RETURN_NORMAL);
|
||||
}
|
||||
if (cmd_find_target(&item->target, item, tflag, CMD_FIND_WINDOW,
|
||||
CMD_FIND_WINDOW_INDEX) != 0)
|
||||
return (CMD_RETURN_ERROR);
|
||||
src = item->source.s;
|
||||
dst = item->target.s;
|
||||
wl = item->source.wl;
|
||||
idx = item->target.idx;
|
||||
|
||||
kflag = args_has(self->args, 'k');
|
||||
dflag = args_has(self->args, 'd');
|
||||
|
@ -44,7 +44,7 @@ const struct cmd_entry cmd_new_session_entry = {
|
||||
"[-s session-name] " CMD_TARGET_SESSION_USAGE " [-x width] "
|
||||
"[-y height] [command]",
|
||||
|
||||
.tflag = CMD_SESSION_CANFAIL,
|
||||
.target = { 't', CMD_FIND_SESSION, CMD_FIND_CANFAIL },
|
||||
|
||||
.flags = CMD_STARTSERVER,
|
||||
.exec = cmd_new_session_exec
|
||||
@ -57,7 +57,7 @@ const struct cmd_entry cmd_has_session_entry = {
|
||||
.args = { "t:", 0, 0 },
|
||||
.usage = CMD_TARGET_SESSION_USAGE,
|
||||
|
||||
.tflag = CMD_SESSION,
|
||||
.target = { 't', CMD_FIND_SESSION, 0 },
|
||||
|
||||
.flags = 0,
|
||||
.exec = cmd_new_session_exec
|
||||
@ -83,8 +83,8 @@ cmd_new_session_exec(struct cmd *self, struct cmdq_item *item)
|
||||
|
||||
if (self->entry == &cmd_has_session_entry) {
|
||||
/*
|
||||
* cmd_prepare() will fail if the session cannot be found,
|
||||
* hence always return success here.
|
||||
* cmd_find_target() will fail if the session cannot be found,
|
||||
* so always return success here.
|
||||
*/
|
||||
return (CMD_RETURN_NORMAL);
|
||||
}
|
||||
@ -102,16 +102,9 @@ cmd_new_session_exec(struct cmd *self, struct cmdq_item *item)
|
||||
}
|
||||
if ((as = session_find(newname)) != NULL) {
|
||||
if (args_has(args, 'A')) {
|
||||
/*
|
||||
* This item is now destined for
|
||||
* attach-session. Because attach-session will
|
||||
* have already been prepared, copy this
|
||||
* session into its tflag so it can be used.
|
||||
*/
|
||||
cmd_find_from_session(&item->state.tflag, as);
|
||||
return (cmd_attach_session(item,
|
||||
args_has(args, 'D'), 0, NULL,
|
||||
args_has(args, 'E')));
|
||||
newname, args_has(args, 'D'),
|
||||
0, NULL, args_has(args, 'E')));
|
||||
}
|
||||
cmdq_error(item, "duplicate session: %s", newname);
|
||||
return (CMD_RETURN_ERROR);
|
||||
@ -121,7 +114,7 @@ cmd_new_session_exec(struct cmd *self, struct cmdq_item *item)
|
||||
/* Is this going to be part of a session group? */
|
||||
group = args_get(args, 't');
|
||||
if (group != NULL) {
|
||||
groupwith = item->state.tflag.s;
|
||||
groupwith = item->target.s;
|
||||
if (groupwith == NULL) {
|
||||
if (!session_check_name(group)) {
|
||||
cmdq_error(item, "bad group name: %s", group);
|
||||
@ -324,8 +317,10 @@ cmd_new_session_exec(struct cmd *self, struct cmdq_item *item)
|
||||
free(cp);
|
||||
}
|
||||
|
||||
if (!detached)
|
||||
if (!detached) {
|
||||
c->flags |= CLIENT_ATTACHED;
|
||||
cmd_find_from_session(&item->shared->current, s);
|
||||
}
|
||||
|
||||
if (to_free != NULL)
|
||||
free((void *)to_free);
|
||||
|
@ -42,7 +42,7 @@ const struct cmd_entry cmd_new_window_entry = {
|
||||
.usage = "[-adkP] [-c start-directory] [-F format] [-n window-name] "
|
||||
CMD_TARGET_WINDOW_USAGE " [command]",
|
||||
|
||||
.tflag = CMD_WINDOW_INDEX,
|
||||
.target = { 't', CMD_FIND_WINDOW, CMD_FIND_WINDOW_INDEX },
|
||||
|
||||
.flags = 0,
|
||||
.exec = cmd_new_window_exec
|
||||
@ -52,10 +52,11 @@ static enum cmd_retval
|
||||
cmd_new_window_exec(struct cmd *self, struct cmdq_item *item)
|
||||
{
|
||||
struct args *args = self->args;
|
||||
struct session *s = item->state.tflag.s;
|
||||
struct winlink *wl = item->state.tflag.wl;
|
||||
struct client *c = item->state.c;
|
||||
int idx = item->state.tflag.idx;
|
||||
struct cmd_find_state *current = &item->shared->current;
|
||||
struct session *s = item->target.s;
|
||||
struct winlink *wl = item->target.wl;
|
||||
struct client *c = cmd_find_client(item, NULL, 1);
|
||||
int idx = item->target.idx;
|
||||
const char *cmd, *path, *template, *cwd, *to_free;
|
||||
char **argv, *cause, *cp;
|
||||
int argc, detached;
|
||||
@ -132,6 +133,7 @@ cmd_new_window_exec(struct cmd *self, struct cmdq_item *item)
|
||||
}
|
||||
if (!detached) {
|
||||
session_select(s, wl->idx);
|
||||
cmd_find_from_winlink(current, wl);
|
||||
server_redraw_session_group(s);
|
||||
} else
|
||||
server_status_session_group(s);
|
||||
|
@ -37,7 +37,7 @@ const struct cmd_entry cmd_paste_buffer_entry = {
|
||||
.usage = "[-dpr] [-s separator] " CMD_BUFFER_USAGE " "
|
||||
CMD_TARGET_PANE_USAGE,
|
||||
|
||||
.tflag = CMD_PANE,
|
||||
.target = { 't', CMD_FIND_PANE, 0 },
|
||||
|
||||
.flags = CMD_AFTERHOOK,
|
||||
.exec = cmd_paste_buffer_exec
|
||||
@ -47,7 +47,7 @@ static enum cmd_retval
|
||||
cmd_paste_buffer_exec(struct cmd *self, struct cmdq_item *item)
|
||||
{
|
||||
struct args *args = self->args;
|
||||
struct window_pane *wp = item->state.tflag.wp;
|
||||
struct window_pane *wp = item->target.wp;
|
||||
struct paste_buffer *pb;
|
||||
const char *sepstr, *bufname, *bufdata, *bufend, *line;
|
||||
size_t seplen, bufsize;
|
||||
|
@ -43,7 +43,7 @@ const struct cmd_entry cmd_pipe_pane_entry = {
|
||||
.args = { "ot:", 0, 1 },
|
||||
.usage = "[-o] " CMD_TARGET_PANE_USAGE " [command]",
|
||||
|
||||
.tflag = CMD_PANE,
|
||||
.target = { 't', CMD_FIND_PANE, 0 },
|
||||
|
||||
.flags = CMD_AFTERHOOK,
|
||||
.exec = cmd_pipe_pane_exec
|
||||
@ -53,10 +53,10 @@ static enum cmd_retval
|
||||
cmd_pipe_pane_exec(struct cmd *self, struct cmdq_item *item)
|
||||
{
|
||||
struct args *args = self->args;
|
||||
struct client *c = item->state.c;
|
||||
struct window_pane *wp = item->state.tflag.wp;
|
||||
struct session *s = item->state.tflag.s;
|
||||
struct winlink *wl = item->state.tflag.wl;
|
||||
struct client *c = cmd_find_client(item, NULL, 1);
|
||||
struct window_pane *wp = item->target.wp;
|
||||
struct session *s = item->target.s;
|
||||
struct winlink *wl = item->target.wl;
|
||||
char *cmd;
|
||||
int old_fd, pipe_fd[2], null_fd;
|
||||
struct format_tree *ft;
|
||||
|
44
cmd-queue.c
44
cmd-queue.c
@ -189,14 +189,34 @@ cmdq_get_command(struct cmd_list *cmdlist, struct cmd_find_state *current,
|
||||
return (first);
|
||||
}
|
||||
|
||||
/* Fill in flag for a command. */
|
||||
static enum cmd_retval
|
||||
cmdq_find_flag(struct cmdq_item *item, struct cmd_find_state *fs,
|
||||
const struct cmd_entry_flag *flag)
|
||||
{
|
||||
const char *value;
|
||||
|
||||
if (flag->flag == 0) {
|
||||
cmd_find_clear_state(fs, 0);
|
||||
return (CMD_RETURN_NORMAL);
|
||||
}
|
||||
|
||||
value = args_get(item->cmd->args, flag->flag);
|
||||
if (cmd_find_target(fs, item, value, flag->type, flag->flags) != 0) {
|
||||
cmd_find_clear_state(fs, 0);
|
||||
return (CMD_RETURN_ERROR);
|
||||
}
|
||||
return (CMD_RETURN_NORMAL);
|
||||
}
|
||||
|
||||
/* Fire command on command queue. */
|
||||
static enum cmd_retval
|
||||
cmdq_fire_command(struct cmdq_item *item)
|
||||
{
|
||||
struct client *c = item->client;
|
||||
struct cmd *cmd = item->cmd;
|
||||
const struct cmd_entry *entry = cmd->entry;
|
||||
enum cmd_retval retval;
|
||||
const char *name;
|
||||
struct cmd_find_state *fsp, fs;
|
||||
int flags;
|
||||
|
||||
@ -205,27 +225,27 @@ cmdq_fire_command(struct cmdq_item *item)
|
||||
|
||||
if (item->client == NULL)
|
||||
item->client = cmd_find_client(item, NULL, 1);
|
||||
|
||||
if (cmd_prepare_state(cmd, item) != 0) {
|
||||
retval = CMD_RETURN_ERROR;
|
||||
retval = cmdq_find_flag(item, &item->source, &entry->source);
|
||||
if (retval == CMD_RETURN_ERROR)
|
||||
goto out;
|
||||
}
|
||||
|
||||
retval = cmd->entry->exec(cmd, item);
|
||||
retval = cmdq_find_flag(item, &item->target, &entry->target);
|
||||
if (retval == CMD_RETURN_ERROR)
|
||||
goto out;
|
||||
|
||||
if (cmd->entry->flags & CMD_AFTERHOOK) {
|
||||
name = cmd->entry->name;
|
||||
if (cmd_find_valid_state(&item->state.tflag))
|
||||
fsp = &item->state.tflag;
|
||||
retval = entry->exec(cmd, item);
|
||||
if (retval == CMD_RETURN_ERROR)
|
||||
goto out;
|
||||
|
||||
if (entry->flags & CMD_AFTERHOOK) {
|
||||
if (cmd_find_valid_state(&item->target))
|
||||
fsp = &item->target;
|
||||
else if (cmd_find_valid_state(&item->shared->current))
|
||||
fsp = &item->shared->current;
|
||||
else if (cmd_find_from_client(&fs, item->client) == 0)
|
||||
fsp = &fs;
|
||||
else
|
||||
goto out;
|
||||
hooks_insert(fsp->s->hooks, item, fsp, "after-%s", name);
|
||||
hooks_insert(fsp->s->hooks, item, fsp, "after-%s", entry->name);
|
||||
}
|
||||
|
||||
out:
|
||||
|
@ -34,8 +34,6 @@ const struct cmd_entry cmd_refresh_client_entry = {
|
||||
.args = { "C:St:", 0, 0 },
|
||||
.usage = "[-S] [-C size] " CMD_TARGET_CLIENT_USAGE,
|
||||
|
||||
.tflag = CMD_CLIENT,
|
||||
|
||||
.flags = CMD_AFTERHOOK,
|
||||
.exec = cmd_refresh_client_exec
|
||||
};
|
||||
@ -44,10 +42,13 @@ static enum cmd_retval
|
||||
cmd_refresh_client_exec(struct cmd *self, struct cmdq_item *item)
|
||||
{
|
||||
struct args *args = self->args;
|
||||
struct client *c = item->state.c;
|
||||
struct client *c;
|
||||
const char *size;
|
||||
u_int w, h;
|
||||
|
||||
if ((c = cmd_find_client(item, args_get(args, 't'), 0)) == NULL)
|
||||
return (CMD_RETURN_ERROR);
|
||||
|
||||
if (args_has(args, 'C')) {
|
||||
if ((size = args_get(args, 'C')) == NULL) {
|
||||
cmdq_error(item, "missing size");
|
||||
|
@ -37,7 +37,7 @@ const struct cmd_entry cmd_rename_session_entry = {
|
||||
.args = { "t:", 1, 1 },
|
||||
.usage = CMD_TARGET_SESSION_USAGE " new-name",
|
||||
|
||||
.tflag = CMD_SESSION,
|
||||
.target = { 't', CMD_FIND_SESSION, 0 },
|
||||
|
||||
.flags = CMD_AFTERHOOK,
|
||||
.exec = cmd_rename_session_exec
|
||||
@ -47,7 +47,7 @@ static enum cmd_retval
|
||||
cmd_rename_session_exec(struct cmd *self, struct cmdq_item *item)
|
||||
{
|
||||
struct args *args = self->args;
|
||||
struct session *s = item->state.tflag.s;
|
||||
struct session *s = item->target.s;
|
||||
const char *newname;
|
||||
|
||||
newname = args->argv[0];
|
||||
|
@ -36,7 +36,7 @@ const struct cmd_entry cmd_rename_window_entry = {
|
||||
.args = { "t:", 1, 1 },
|
||||
.usage = CMD_TARGET_WINDOW_USAGE " new-name",
|
||||
|
||||
.tflag = CMD_WINDOW,
|
||||
.target = { 't', CMD_FIND_WINDOW, 0 },
|
||||
|
||||
.flags = CMD_AFTERHOOK,
|
||||
.exec = cmd_rename_window_exec
|
||||
@ -46,7 +46,7 @@ static enum cmd_retval
|
||||
cmd_rename_window_exec(struct cmd *self, struct cmdq_item *item)
|
||||
{
|
||||
struct args *args = self->args;
|
||||
struct winlink *wl = item->state.tflag.wl;
|
||||
struct winlink *wl = item->target.wl;
|
||||
|
||||
window_set_name(wl->window, args->argv[0]);
|
||||
options_set_number(wl->window->options, "automatic-rename", 0);
|
||||
|
@ -39,7 +39,7 @@ const struct cmd_entry cmd_resize_pane_entry = {
|
||||
.usage = "[-DLMRUZ] [-x width] [-y height] " CMD_TARGET_PANE_USAGE " "
|
||||
"[adjustment]",
|
||||
|
||||
.tflag = CMD_PANE,
|
||||
.target = { 't', CMD_FIND_PANE, 0 },
|
||||
|
||||
.flags = CMD_AFTERHOOK,
|
||||
.exec = cmd_resize_pane_exec
|
||||
@ -50,11 +50,11 @@ cmd_resize_pane_exec(struct cmd *self, struct cmdq_item *item)
|
||||
{
|
||||
struct args *args = self->args;
|
||||
struct cmdq_shared *shared = item->shared;
|
||||
struct window_pane *wp = item->state.tflag.wp;
|
||||
struct winlink *wl = item->state.tflag.wl;
|
||||
struct window_pane *wp = item->target.wp;
|
||||
struct winlink *wl = item->target.wl;
|
||||
struct window *w = wl->window;
|
||||
struct client *c = item->client;
|
||||
struct session *s = item->state.tflag.s;
|
||||
struct session *s = item->target.s;
|
||||
const char *errstr;
|
||||
char *cause;
|
||||
u_int adjust;
|
||||
|
@ -37,7 +37,7 @@ const struct cmd_entry cmd_respawn_pane_entry = {
|
||||
.args = { "kt:", 0, -1 },
|
||||
.usage = "[-k] " CMD_TARGET_PANE_USAGE " [command]",
|
||||
|
||||
.tflag = CMD_PANE,
|
||||
.target = { 't', CMD_FIND_PANE, 0 },
|
||||
|
||||
.flags = 0,
|
||||
.exec = cmd_respawn_pane_exec
|
||||
@ -47,10 +47,10 @@ static enum cmd_retval
|
||||
cmd_respawn_pane_exec(struct cmd *self, struct cmdq_item *item)
|
||||
{
|
||||
struct args *args = self->args;
|
||||
struct winlink *wl = item->state.tflag.wl;
|
||||
struct winlink *wl = item->target.wl;
|
||||
struct window *w = wl->window;
|
||||
struct window_pane *wp = item->state.tflag.wp;
|
||||
struct session *s = item->state.tflag.s;
|
||||
struct window_pane *wp = item->target.wp;
|
||||
struct session *s = item->target.s;
|
||||
struct environ *env;
|
||||
const char *path;
|
||||
char *cause;
|
||||
|
@ -37,7 +37,7 @@ const struct cmd_entry cmd_respawn_window_entry = {
|
||||
.args = { "kt:", 0, -1 },
|
||||
.usage = "[-k] " CMD_TARGET_WINDOW_USAGE " [command]",
|
||||
|
||||
.tflag = CMD_WINDOW,
|
||||
.target = { 't', CMD_FIND_WINDOW, 0 },
|
||||
|
||||
.flags = 0,
|
||||
.exec = cmd_respawn_window_exec
|
||||
@ -47,8 +47,8 @@ static enum cmd_retval
|
||||
cmd_respawn_window_exec(struct cmd *self, struct cmdq_item *item)
|
||||
{
|
||||
struct args *args = self->args;
|
||||
struct session *s = item->state.tflag.s;
|
||||
struct winlink *wl = item->state.tflag.wl;
|
||||
struct session *s = item->target.s;
|
||||
struct winlink *wl = item->target.wl;
|
||||
struct window *w = wl->window;
|
||||
struct window_pane *wp;
|
||||
struct environ *env;
|
||||
|
@ -34,7 +34,7 @@ const struct cmd_entry cmd_rotate_window_entry = {
|
||||
.args = { "Dt:U", 0, 0 },
|
||||
.usage = "[-DU] " CMD_TARGET_WINDOW_USAGE,
|
||||
|
||||
.tflag = CMD_WINDOW,
|
||||
.target = { 't', CMD_FIND_WINDOW, 0 },
|
||||
|
||||
.flags = 0,
|
||||
.exec = cmd_rotate_window_exec
|
||||
@ -43,7 +43,7 @@ const struct cmd_entry cmd_rotate_window_entry = {
|
||||
static enum cmd_retval
|
||||
cmd_rotate_window_exec(struct cmd *self, struct cmdq_item *item)
|
||||
{
|
||||
struct winlink *wl = item->state.tflag.wl;
|
||||
struct winlink *wl = item->target.wl;
|
||||
struct window *w = wl->window;
|
||||
struct window_pane *wp, *wp2;
|
||||
struct layout_cell *lc;
|
||||
|
@ -42,7 +42,7 @@ const struct cmd_entry cmd_run_shell_entry = {
|
||||
.args = { "bt:", 1, 1 },
|
||||
.usage = "[-b] " CMD_TARGET_PANE_USAGE " shell-command",
|
||||
|
||||
.tflag = CMD_PANE_CANFAIL,
|
||||
.target = { 't', CMD_FIND_PANE, CMD_FIND_CANFAIL },
|
||||
|
||||
.flags = 0,
|
||||
.exec = cmd_run_shell_exec
|
||||
@ -86,10 +86,10 @@ cmd_run_shell_exec(struct cmd *self, struct cmdq_item *item)
|
||||
{
|
||||
struct args *args = self->args;
|
||||
struct cmd_run_shell_data *cdata;
|
||||
struct client *c = item->state.c;
|
||||
struct session *s = item->state.tflag.s;
|
||||
struct winlink *wl = item->state.tflag.wl;
|
||||
struct window_pane *wp = item->state.tflag.wp;
|
||||
struct client *c = cmd_find_client(item, NULL, 1);
|
||||
struct session *s = item->target.s;
|
||||
struct winlink *wl = item->target.wl;
|
||||
struct window_pane *wp = item->target.wp;
|
||||
const char *cwd;
|
||||
|
||||
if (item->client != NULL && item->client->session == NULL)
|
||||
|
@ -36,7 +36,7 @@ const struct cmd_entry cmd_select_layout_entry = {
|
||||
.args = { "nopt:", 0, 1 },
|
||||
.usage = "[-nop] " CMD_TARGET_WINDOW_USAGE " [layout-name]",
|
||||
|
||||
.tflag = CMD_WINDOW,
|
||||
.target = { 't', CMD_FIND_WINDOW, 0 },
|
||||
|
||||
.flags = CMD_AFTERHOOK,
|
||||
.exec = cmd_select_layout_exec
|
||||
@ -49,7 +49,7 @@ const struct cmd_entry cmd_next_layout_entry = {
|
||||
.args = { "t:", 0, 0 },
|
||||
.usage = CMD_TARGET_WINDOW_USAGE,
|
||||
|
||||
.tflag = CMD_WINDOW,
|
||||
.target = { 't', CMD_FIND_WINDOW, 0 },
|
||||
|
||||
.flags = CMD_AFTERHOOK,
|
||||
.exec = cmd_select_layout_exec
|
||||
@ -62,7 +62,7 @@ const struct cmd_entry cmd_previous_layout_entry = {
|
||||
.args = { "t:", 0, 0 },
|
||||
.usage = CMD_TARGET_WINDOW_USAGE,
|
||||
|
||||
.tflag = CMD_WINDOW,
|
||||
.target = { 't', CMD_FIND_WINDOW, 0 },
|
||||
|
||||
.flags = CMD_AFTERHOOK,
|
||||
.exec = cmd_select_layout_exec
|
||||
@ -72,7 +72,7 @@ static enum cmd_retval
|
||||
cmd_select_layout_exec(struct cmd *self, struct cmdq_item *item)
|
||||
{
|
||||
struct args *args = self->args;
|
||||
struct winlink *wl = item->state.tflag.wl;
|
||||
struct winlink *wl = item->target.wl;
|
||||
struct window *w;
|
||||
const char *layoutname;
|
||||
char *oldlayout;
|
||||
|
@ -33,7 +33,7 @@ const struct cmd_entry cmd_select_pane_entry = {
|
||||
.args = { "DdegLlMmP:Rt:U", 0, 0 },
|
||||
.usage = "[-DdegLlMmRU] [-P style] " CMD_TARGET_PANE_USAGE,
|
||||
|
||||
.tflag = CMD_PANE,
|
||||
.target = { 't', CMD_FIND_PANE, 0 },
|
||||
|
||||
.flags = 0,
|
||||
.exec = cmd_select_pane_exec
|
||||
@ -46,7 +46,7 @@ const struct cmd_entry cmd_last_pane_entry = {
|
||||
.args = { "det:", 0, 0 },
|
||||
.usage = "[-de] " CMD_TARGET_WINDOW_USAGE,
|
||||
|
||||
.tflag = CMD_WINDOW,
|
||||
.target = { 't', CMD_FIND_WINDOW, 0 },
|
||||
|
||||
.flags = 0,
|
||||
.exec = cmd_select_pane_exec
|
||||
@ -56,10 +56,11 @@ static enum cmd_retval
|
||||
cmd_select_pane_exec(struct cmd *self, struct cmdq_item *item)
|
||||
{
|
||||
struct args *args = self->args;
|
||||
struct winlink *wl = item->state.tflag.wl;
|
||||
struct cmd_find_state *current = &item->shared->current;
|
||||
struct winlink *wl = item->target.wl;
|
||||
struct window *w = wl->window;
|
||||
struct session *s = item->state.tflag.s;
|
||||
struct window_pane *wp = item->state.tflag.wp, *lastwp, *markedwp;
|
||||
struct session *s = item->target.s;
|
||||
struct window_pane *wp = item->target.wp, *lastwp, *markedwp;
|
||||
const char *style;
|
||||
|
||||
if (self->entry == &cmd_last_pane_entry || args_has(args, 'l')) {
|
||||
@ -68,7 +69,6 @@ cmd_select_pane_exec(struct cmd *self, struct cmdq_item *item)
|
||||
cmdq_error(item, "no last pane");
|
||||
return (CMD_RETURN_ERROR);
|
||||
}
|
||||
|
||||
if (args_has(self->args, 'e'))
|
||||
lastwp->flags &= ~PANE_INPUTOFF;
|
||||
else if (args_has(self->args, 'd'))
|
||||
@ -77,6 +77,7 @@ cmd_select_pane_exec(struct cmd *self, struct cmdq_item *item)
|
||||
server_unzoom_window(w);
|
||||
window_redraw_active_switch(w, lastwp);
|
||||
if (window_set_active_pane(w, lastwp)) {
|
||||
cmd_find_from_winlink(current, wl);
|
||||
server_status_window(w);
|
||||
server_redraw_window_borders(w);
|
||||
}
|
||||
@ -155,6 +156,7 @@ cmd_select_pane_exec(struct cmd *self, struct cmdq_item *item)
|
||||
}
|
||||
window_redraw_active_switch(w, wp);
|
||||
if (window_set_active_pane(w, wp)) {
|
||||
cmd_find_from_winlink(current, wl);
|
||||
server_status_window(w);
|
||||
server_redraw_window_borders(w);
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ const struct cmd_entry cmd_select_window_entry = {
|
||||
.args = { "lnpTt:", 0, 0 },
|
||||
.usage = "[-lnpT] " CMD_TARGET_WINDOW_USAGE,
|
||||
|
||||
.tflag = CMD_WINDOW,
|
||||
.target = { 't', CMD_FIND_WINDOW, 0 },
|
||||
|
||||
.flags = 0,
|
||||
.exec = cmd_select_window_exec
|
||||
@ -49,7 +49,7 @@ const struct cmd_entry cmd_next_window_entry = {
|
||||
.args = { "at:", 0, 0 },
|
||||
.usage = "[-a] " CMD_TARGET_SESSION_USAGE,
|
||||
|
||||
.tflag = CMD_SESSION,
|
||||
.target = { 't', CMD_FIND_SESSION, 0 },
|
||||
|
||||
.flags = 0,
|
||||
.exec = cmd_select_window_exec
|
||||
@ -62,7 +62,7 @@ const struct cmd_entry cmd_previous_window_entry = {
|
||||
.args = { "at:", 0, 0 },
|
||||
.usage = "[-a] " CMD_TARGET_SESSION_USAGE,
|
||||
|
||||
.tflag = CMD_SESSION,
|
||||
.target = { 't', CMD_FIND_SESSION, 0 },
|
||||
|
||||
.flags = 0,
|
||||
.exec = cmd_select_window_exec
|
||||
@ -75,7 +75,7 @@ const struct cmd_entry cmd_last_window_entry = {
|
||||
.args = { "t:", 0, 0 },
|
||||
.usage = CMD_TARGET_SESSION_USAGE,
|
||||
|
||||
.tflag = CMD_SESSION,
|
||||
.target = { 't', CMD_FIND_SESSION, 0 },
|
||||
|
||||
.flags = 0,
|
||||
.exec = cmd_select_window_exec
|
||||
@ -84,9 +84,10 @@ const struct cmd_entry cmd_last_window_entry = {
|
||||
static enum cmd_retval
|
||||
cmd_select_window_exec(struct cmd *self, struct cmdq_item *item)
|
||||
{
|
||||
struct winlink *wl = item->state.tflag.wl;
|
||||
struct session *s = item->state.tflag.s;
|
||||
int next, previous, last, activity;
|
||||
struct cmd_find_state *current = &item->shared->current;
|
||||
struct winlink *wl = item->target.wl;
|
||||
struct session *s = item->target.s;
|
||||
int next, previous, last, activity;
|
||||
|
||||
next = self->entry == &cmd_next_window_entry;
|
||||
if (args_has(self->args, 'n'))
|
||||
@ -116,7 +117,7 @@ cmd_select_window_exec(struct cmd *self, struct cmdq_item *item)
|
||||
return (CMD_RETURN_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
cmd_find_from_session(&item->shared->current, s);
|
||||
server_redraw_session(s);
|
||||
} else {
|
||||
/*
|
||||
@ -128,9 +129,13 @@ cmd_select_window_exec(struct cmd *self, struct cmdq_item *item)
|
||||
cmdq_error(item, "no last window");
|
||||
return (-1);
|
||||
}
|
||||
if (current->s == s)
|
||||
cmd_find_from_session(current, s);
|
||||
server_redraw_session(s);
|
||||
} else if (session_select(s, wl->idx) == 0)
|
||||
} else if (session_select(s, wl->idx) == 0) {
|
||||
cmd_find_from_session(current, s);
|
||||
server_redraw_session(s);
|
||||
}
|
||||
}
|
||||
recalculate_sizes();
|
||||
|
||||
|
@ -36,7 +36,7 @@ const struct cmd_entry cmd_send_keys_entry = {
|
||||
.args = { "lXRMN:t:", 0, -1 },
|
||||
.usage = "[-lXRM] [-N repeat-count] " CMD_TARGET_PANE_USAGE " key ...",
|
||||
|
||||
.tflag = CMD_PANE,
|
||||
.target = { 't', CMD_FIND_PANE, 0 },
|
||||
|
||||
.flags = CMD_AFTERHOOK,
|
||||
.exec = cmd_send_keys_exec
|
||||
@ -49,7 +49,7 @@ const struct cmd_entry cmd_send_prefix_entry = {
|
||||
.args = { "2t:", 0, 0 },
|
||||
.usage = "[-2] " CMD_TARGET_PANE_USAGE,
|
||||
|
||||
.tflag = CMD_PANE,
|
||||
.target = { 't', CMD_FIND_PANE, 0 },
|
||||
|
||||
.flags = CMD_AFTERHOOK,
|
||||
.exec = cmd_send_keys_exec
|
||||
@ -59,9 +59,9 @@ static enum cmd_retval
|
||||
cmd_send_keys_exec(struct cmd *self, struct cmdq_item *item)
|
||||
{
|
||||
struct args *args = self->args;
|
||||
struct client *c = item->state.c;
|
||||
struct window_pane *wp = item->state.tflag.wp;
|
||||
struct session *s = item->state.tflag.s;
|
||||
struct client *c = cmd_find_client(item, NULL, 1);
|
||||
struct window_pane *wp = item->target.wp;
|
||||
struct session *s = item->target.s;
|
||||
struct mouse_event *m = &item->shared->mouse;
|
||||
struct utf8_data *ud, *uc;
|
||||
wchar_t wc;
|
||||
|
@ -37,7 +37,7 @@ const struct cmd_entry cmd_set_environment_entry = {
|
||||
.args = { "grt:u", 1, 2 },
|
||||
.usage = "[-gru] " CMD_TARGET_SESSION_USAGE " name [value]",
|
||||
|
||||
.tflag = CMD_SESSION_CANFAIL,
|
||||
.target = { 't', CMD_FIND_SESSION, CMD_FIND_CANFAIL },
|
||||
|
||||
.flags = CMD_AFTERHOOK,
|
||||
.exec = cmd_set_environment_exec
|
||||
@ -68,7 +68,7 @@ cmd_set_environment_exec(struct cmd *self, struct cmdq_item *item)
|
||||
if (args_has(self->args, 'g'))
|
||||
env = global_environ;
|
||||
else {
|
||||
if (item->state.tflag.s == NULL) {
|
||||
if (item->target.s == NULL) {
|
||||
target = args_get(args, 't');
|
||||
if (target != NULL)
|
||||
cmdq_error(item, "no such session: %s", target);
|
||||
@ -76,7 +76,7 @@ cmd_set_environment_exec(struct cmd *self, struct cmdq_item *item)
|
||||
cmdq_error(item, "no current session");
|
||||
return (CMD_RETURN_ERROR);
|
||||
}
|
||||
env = item->state.tflag.s->environ;
|
||||
env = item->target.s->environ;
|
||||
}
|
||||
|
||||
if (args_has(self->args, 'u')) {
|
||||
|
@ -36,7 +36,7 @@ const struct cmd_entry cmd_set_hook_entry = {
|
||||
.args = { "gt:u", 1, 2 },
|
||||
.usage = "[-gu] " CMD_TARGET_SESSION_USAGE " hook-name [command]",
|
||||
|
||||
.tflag = CMD_SESSION_CANFAIL,
|
||||
.target = { 't', CMD_FIND_SESSION, CMD_FIND_CANFAIL },
|
||||
|
||||
.flags = CMD_AFTERHOOK,
|
||||
.exec = cmd_set_hook_exec
|
||||
@ -49,7 +49,7 @@ const struct cmd_entry cmd_show_hooks_entry = {
|
||||
.args = { "gt:", 0, 1 },
|
||||
.usage = "[-g] " CMD_TARGET_SESSION_USAGE,
|
||||
|
||||
.tflag = CMD_SESSION,
|
||||
.target = { 't', CMD_FIND_SESSION, 0 },
|
||||
|
||||
.flags = CMD_AFTERHOOK,
|
||||
.exec = cmd_set_hook_exec
|
||||
@ -68,7 +68,7 @@ cmd_set_hook_exec(struct cmd *self, struct cmdq_item *item)
|
||||
if (args_has(args, 'g'))
|
||||
hooks = global_hooks;
|
||||
else {
|
||||
if (item->state.tflag.s == NULL) {
|
||||
if (item->target.s == NULL) {
|
||||
target = args_get(args, 't');
|
||||
if (target != NULL)
|
||||
cmdq_error(item, "no such session: %s", target);
|
||||
@ -76,7 +76,7 @@ cmd_set_hook_exec(struct cmd *self, struct cmdq_item *item)
|
||||
cmdq_error(item, "no current session");
|
||||
return (CMD_RETURN_ERROR);
|
||||
}
|
||||
hooks = item->state.tflag.s->hooks;
|
||||
hooks = item->target.s->hooks;
|
||||
}
|
||||
|
||||
if (self->entry == &cmd_show_hooks_entry) {
|
||||
|
@ -45,7 +45,7 @@ const struct cmd_entry cmd_set_option_entry = {
|
||||
.args = { "agoqst:uw", 1, 2 },
|
||||
.usage = "[-agosquw] [-t target-window] option [value]",
|
||||
|
||||
.tflag = CMD_WINDOW_CANFAIL,
|
||||
.target = { 't', CMD_FIND_WINDOW, CMD_FIND_CANFAIL },
|
||||
|
||||
.flags = CMD_AFTERHOOK,
|
||||
.exec = cmd_set_option_exec
|
||||
@ -58,7 +58,7 @@ const struct cmd_entry cmd_set_window_option_entry = {
|
||||
.args = { "agoqt:u", 1, 2 },
|
||||
.usage = "[-agoqu] " CMD_TARGET_WINDOW_USAGE " option [value]",
|
||||
|
||||
.tflag = CMD_WINDOW_CANFAIL,
|
||||
.target = { 't', CMD_FIND_WINDOW, CMD_FIND_CANFAIL },
|
||||
|
||||
.flags = CMD_AFTERHOOK,
|
||||
.exec = cmd_set_option_exec
|
||||
@ -69,7 +69,7 @@ cmd_set_option_exec(struct cmd *self, struct cmdq_item *item)
|
||||
{
|
||||
struct args *args = self->args;
|
||||
int append = args_has(args, 'a');
|
||||
struct cmd_find_state *fs = &item->state.tflag;
|
||||
struct cmd_find_state *fs = &item->target;
|
||||
struct session *s = fs->s;
|
||||
struct winlink *wl = fs->wl;
|
||||
struct window *w;
|
||||
|
@ -41,7 +41,7 @@ const struct cmd_entry cmd_show_environment_entry = {
|
||||
.args = { "gst:", 0, 1 },
|
||||
.usage = "[-gs] " CMD_TARGET_SESSION_USAGE " [name]",
|
||||
|
||||
.tflag = CMD_SESSION_CANFAIL,
|
||||
.target = { 't', CMD_FIND_SESSION, CMD_FIND_CANFAIL },
|
||||
|
||||
.flags = CMD_AFTERHOOK,
|
||||
.exec = cmd_show_environment_exec
|
||||
@ -97,7 +97,7 @@ cmd_show_environment_exec(struct cmd *self, struct cmdq_item *item)
|
||||
const char *target;
|
||||
|
||||
if ((target = args_get(args, 't')) != NULL) {
|
||||
if (item->state.tflag.s == NULL) {
|
||||
if (item->target.s == NULL) {
|
||||
cmdq_error(item, "no such session: %s", target);
|
||||
return (CMD_RETURN_ERROR);
|
||||
}
|
||||
@ -106,7 +106,7 @@ cmd_show_environment_exec(struct cmd *self, struct cmdq_item *item)
|
||||
if (args_has(self->args, 'g'))
|
||||
env = global_environ;
|
||||
else {
|
||||
if (item->state.tflag.s == NULL) {
|
||||
if (item->target.s == NULL) {
|
||||
target = args_get(args, 't');
|
||||
if (target != NULL)
|
||||
cmdq_error(item, "no such session: %s", target);
|
||||
@ -114,7 +114,7 @@ cmd_show_environment_exec(struct cmd *self, struct cmdq_item *item)
|
||||
cmdq_error(item, "no current session");
|
||||
return (CMD_RETURN_ERROR);
|
||||
}
|
||||
env = item->state.tflag.s->environ;
|
||||
env = item->target.s->environ;
|
||||
}
|
||||
|
||||
if (args->argc != 0) {
|
||||
|
@ -38,8 +38,6 @@ const struct cmd_entry cmd_show_messages_entry = {
|
||||
.args = { "JTt:", 0, 0 },
|
||||
.usage = "[-JT] " CMD_TARGET_CLIENT_USAGE,
|
||||
|
||||
.tflag = CMD_CLIENT,
|
||||
|
||||
.flags = CMD_AFTERHOOK,
|
||||
.exec = cmd_show_messages_exec
|
||||
};
|
||||
@ -91,11 +89,14 @@ static enum cmd_retval
|
||||
cmd_show_messages_exec(struct cmd *self, struct cmdq_item *item)
|
||||
{
|
||||
struct args *args = self->args;
|
||||
struct client *c = item->state.c;
|
||||
struct client *c;
|
||||
struct message_entry *msg;
|
||||
char *tim;
|
||||
int done, blank;
|
||||
|
||||
if ((c = cmd_find_client(item, args_get(args, 't'), 0)) == NULL)
|
||||
return (CMD_RETURN_ERROR);
|
||||
|
||||
done = blank = 0;
|
||||
if (args_has(args, 'T')) {
|
||||
blank = cmd_show_messages_terminals(item, blank);
|
||||
|
@ -41,7 +41,7 @@ const struct cmd_entry cmd_show_options_entry = {
|
||||
.args = { "gqst:vw", 0, 1 },
|
||||
.usage = "[-gqsvw] [-t target-session|target-window] [option]",
|
||||
|
||||
.tflag = CMD_WINDOW_CANFAIL,
|
||||
.target = { 't', CMD_FIND_WINDOW, CMD_FIND_CANFAIL },
|
||||
|
||||
.flags = CMD_AFTERHOOK,
|
||||
.exec = cmd_show_options_exec
|
||||
@ -54,7 +54,7 @@ const struct cmd_entry cmd_show_window_options_entry = {
|
||||
.args = { "gvt:", 0, 1 },
|
||||
.usage = "[-gv] " CMD_TARGET_WINDOW_USAGE " [option]",
|
||||
|
||||
.tflag = CMD_WINDOW_CANFAIL,
|
||||
.target = { 't', CMD_FIND_WINDOW, CMD_FIND_CANFAIL },
|
||||
|
||||
.flags = CMD_AFTERHOOK,
|
||||
.exec = cmd_show_options_exec
|
||||
@ -64,7 +64,7 @@ static enum cmd_retval
|
||||
cmd_show_options_exec(struct cmd *self, struct cmdq_item *item)
|
||||
{
|
||||
struct args *args = self->args;
|
||||
struct cmd_find_state *fs = &item->state.tflag;
|
||||
struct cmd_find_state *fs = &item->target;
|
||||
struct options *oo;
|
||||
enum options_table_scope scope;
|
||||
char *cause;
|
||||
|
@ -43,7 +43,7 @@ const struct cmd_entry cmd_split_window_entry = {
|
||||
.usage = "[-bdfhvP] [-c start-directory] [-F format] "
|
||||
"[-p percentage|-l size] " CMD_TARGET_PANE_USAGE " [command]",
|
||||
|
||||
.tflag = CMD_PANE,
|
||||
.target = { 't', CMD_FIND_PANE, 0 },
|
||||
|
||||
.flags = 0,
|
||||
.exec = cmd_split_window_exec
|
||||
@ -52,12 +52,13 @@ const struct cmd_entry cmd_split_window_entry = {
|
||||
static enum cmd_retval
|
||||
cmd_split_window_exec(struct cmd *self, struct cmdq_item *item)
|
||||
{
|
||||
struct cmd_find_state *current = &item->shared->current;
|
||||
struct args *args = self->args;
|
||||
struct client *c = item->state.c;
|
||||
struct session *s = item->state.tflag.s;
|
||||
struct winlink *wl = item->state.tflag.wl;
|
||||
struct client *c = cmd_find_client(item, NULL, 1);
|
||||
struct session *s = item->target.s;
|
||||
struct winlink *wl = item->target.wl;
|
||||
struct window *w = wl->window;
|
||||
struct window_pane *wp = item->state.tflag.wp, *new_wp = NULL;
|
||||
struct window_pane *wp = item->target.wp, *new_wp = NULL;
|
||||
struct environ *env;
|
||||
const char *cmd, *path, *shell, *template, *cwd, *to_free;
|
||||
char **argv, *cause, *new_cause, *cp;
|
||||
@ -155,6 +156,7 @@ cmd_split_window_exec(struct cmd *self, struct cmdq_item *item)
|
||||
if (!args_has(args, 'd')) {
|
||||
window_set_active_pane(w, new_wp);
|
||||
session_select(s, wl->idx);
|
||||
cmd_find_from_session(current, s);
|
||||
server_redraw_session(s);
|
||||
} else
|
||||
server_status_session(s);
|
||||
|
@ -35,8 +35,8 @@ const struct cmd_entry cmd_swap_pane_entry = {
|
||||
.args = { "dDs:t:U", 0, 0 },
|
||||
.usage = "[-dDU] " CMD_SRCDST_PANE_USAGE,
|
||||
|
||||
.sflag = CMD_PANE_MARKED,
|
||||
.tflag = CMD_PANE,
|
||||
.source = { 's', CMD_FIND_PANE, CMD_FIND_DEFAULT_MARKED },
|
||||
.target = { 't', CMD_FIND_PANE, 0 },
|
||||
|
||||
.flags = 0,
|
||||
.exec = cmd_swap_pane_exec
|
||||
@ -50,10 +50,10 @@ cmd_swap_pane_exec(struct cmd *self, struct cmdq_item *item)
|
||||
struct layout_cell *src_lc, *dst_lc;
|
||||
u_int sx, sy, xoff, yoff;
|
||||
|
||||
dst_w = item->state.tflag.wl->window;
|
||||
dst_wp = item->state.tflag.wp;
|
||||
src_w = item->state.sflag.wl->window;
|
||||
src_wp = item->state.sflag.wp;
|
||||
dst_w = item->target.wl->window;
|
||||
dst_wp = item->target.wp;
|
||||
src_w = item->source.wl->window;
|
||||
src_wp = item->source.wp;
|
||||
server_unzoom_window(dst_w);
|
||||
|
||||
if (args_has(self->args, 'D')) {
|
||||
|
@ -35,8 +35,8 @@ const struct cmd_entry cmd_swap_window_entry = {
|
||||
.args = { "ds:t:", 0, 0 },
|
||||
.usage = "[-d] " CMD_SRCDST_WINDOW_USAGE,
|
||||
|
||||
.sflag = CMD_WINDOW_MARKED,
|
||||
.tflag = CMD_WINDOW,
|
||||
.source = { 's', CMD_FIND_WINDOW, CMD_FIND_DEFAULT_MARKED },
|
||||
.target = { 't', CMD_FIND_WINDOW, 0 },
|
||||
|
||||
.flags = 0,
|
||||
.exec = cmd_swap_window_exec
|
||||
@ -50,12 +50,12 @@ cmd_swap_window_exec(struct cmd *self, struct cmdq_item *item)
|
||||
struct winlink *wl_src, *wl_dst;
|
||||
struct window *w_src, *w_dst;
|
||||
|
||||
wl_src = item->state.sflag.wl;
|
||||
src = item->state.sflag.s;
|
||||
wl_src = item->source.wl;
|
||||
src = item->source.s;
|
||||
sg_src = session_group_contains(src);
|
||||
|
||||
wl_dst = item->state.tflag.wl;
|
||||
dst = item->state.tflag.s;
|
||||
wl_dst = item->target.wl;
|
||||
dst = item->target.s;
|
||||
sg_dst = session_group_contains(dst);
|
||||
|
||||
if (src != dst && sg_src != NULL && sg_dst != NULL &&
|
||||
|
@ -38,8 +38,7 @@ const struct cmd_entry cmd_switch_client_entry = {
|
||||
.usage = "[-Elnpr] [-c target-client] [-t target-session] "
|
||||
"[-T key-table]",
|
||||
|
||||
.cflag = CMD_CLIENT,
|
||||
.tflag = CMD_SESSION_WITHPANE,
|
||||
/* -t is special */
|
||||
|
||||
.flags = CMD_READONLY,
|
||||
.exec = cmd_switch_client_exec
|
||||
@ -49,13 +48,32 @@ static enum cmd_retval
|
||||
cmd_switch_client_exec(struct cmd *self, struct cmdq_item *item)
|
||||
{
|
||||
struct args *args = self->args;
|
||||
struct cmd_state *state = &item->state;
|
||||
struct client *c = state->c;
|
||||
struct session *s = item->state.tflag.s;
|
||||
const char *tflag = args_get(args, 't');
|
||||
enum cmd_find_type type;
|
||||
int flags;
|
||||
struct client *c;
|
||||
struct session *s;
|
||||
struct winlink *wl;
|
||||
struct window_pane *wp;
|
||||
const char *tablename;
|
||||
struct key_table *table;
|
||||
|
||||
if ((c = cmd_find_client(item, args_get(args, 'c'), 0)) == NULL)
|
||||
return (CMD_RETURN_ERROR);
|
||||
|
||||
if (tflag != NULL && tflag[strcspn(tflag, ":.")] != '\0') {
|
||||
type = CMD_FIND_PANE;
|
||||
flags = 0;
|
||||
} else {
|
||||
type = CMD_FIND_SESSION;
|
||||
flags = CMD_FIND_PREFER_UNATTACHED;
|
||||
}
|
||||
if (cmd_find_target(&item->target, item, tflag, type, flags) != 0)
|
||||
return (CMD_RETURN_ERROR);
|
||||
s = item->target.s;
|
||||
wl = item->target.wl;
|
||||
wp = item->target.wp;
|
||||
|
||||
if (args_has(args, 'r'))
|
||||
c->flags ^= CLIENT_READONLY;
|
||||
|
||||
@ -94,11 +112,11 @@ cmd_switch_client_exec(struct cmd *self, struct cmdq_item *item)
|
||||
} else {
|
||||
if (item->client == NULL)
|
||||
return (CMD_RETURN_NORMAL);
|
||||
if (state->tflag.wl != NULL) {
|
||||
wp = state->tflag.wp;
|
||||
if (wl != NULL) {
|
||||
if (wp != NULL)
|
||||
window_set_active_pane(wp->window, wp);
|
||||
session_set_current(s, state->tflag.wl);
|
||||
session_set_current(s, wl);
|
||||
cmd_find_from_session(&item->shared->current, s);
|
||||
}
|
||||
}
|
||||
|
||||
|
174
cmd.c
174
cmd.c
@ -447,180 +447,6 @@ usage:
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
static int
|
||||
cmd_prepare_state_flag(char c, const char *target, enum cmd_entry_flag flag,
|
||||
struct cmdq_item *item)
|
||||
{
|
||||
int targetflags, error;
|
||||
struct cmd_find_state *fs = NULL;
|
||||
|
||||
if (flag == CMD_NONE ||
|
||||
flag == CMD_CLIENT ||
|
||||
flag == CMD_CLIENT_CANFAIL)
|
||||
return (0);
|
||||
|
||||
if (c == 't')
|
||||
fs = &item->state.tflag;
|
||||
else if (c == 's')
|
||||
fs = &item->state.sflag;
|
||||
|
||||
if (flag == CMD_SESSION_WITHPANE) {
|
||||
if (target != NULL && target[strcspn(target, ":.")] != '\0')
|
||||
flag = CMD_PANE;
|
||||
else
|
||||
flag = CMD_SESSION_PREFERUNATTACHED;
|
||||
}
|
||||
|
||||
targetflags = 0;
|
||||
switch (flag) {
|
||||
case CMD_SESSION:
|
||||
case CMD_SESSION_CANFAIL:
|
||||
case CMD_SESSION_PREFERUNATTACHED:
|
||||
case CMD_SESSION_WITHPANE:
|
||||
if (flag == CMD_SESSION_CANFAIL)
|
||||
targetflags |= CMD_FIND_QUIET;
|
||||
if (flag == CMD_SESSION_PREFERUNATTACHED)
|
||||
targetflags |= CMD_FIND_PREFER_UNATTACHED;
|
||||
break;
|
||||
case CMD_MOVEW_R:
|
||||
flag = CMD_WINDOW_INDEX;
|
||||
/* FALLTHROUGH */
|
||||
case CMD_WINDOW:
|
||||
case CMD_WINDOW_CANFAIL:
|
||||
case CMD_WINDOW_MARKED:
|
||||
case CMD_WINDOW_INDEX:
|
||||
if (flag == CMD_WINDOW_CANFAIL)
|
||||
targetflags |= CMD_FIND_QUIET;
|
||||
if (flag == CMD_WINDOW_MARKED)
|
||||
targetflags |= CMD_FIND_DEFAULT_MARKED;
|
||||
if (flag == CMD_WINDOW_INDEX)
|
||||
targetflags |= CMD_FIND_WINDOW_INDEX;
|
||||
break;
|
||||
case CMD_PANE:
|
||||
case CMD_PANE_CANFAIL:
|
||||
case CMD_PANE_MARKED:
|
||||
if (flag == CMD_PANE_CANFAIL)
|
||||
targetflags |= CMD_FIND_QUIET;
|
||||
if (flag == CMD_PANE_MARKED)
|
||||
targetflags |= CMD_FIND_DEFAULT_MARKED;
|
||||
break;
|
||||
default:
|
||||
fatalx("unknown %cflag %d", c, flag);
|
||||
}
|
||||
log_debug("%s: flag %c %d %#x", __func__, c, flag, targetflags);
|
||||
|
||||
switch (flag) {
|
||||
case CMD_NONE:
|
||||
case CMD_CLIENT:
|
||||
case CMD_CLIENT_CANFAIL:
|
||||
return (0);
|
||||
case CMD_SESSION:
|
||||
case CMD_SESSION_CANFAIL:
|
||||
case CMD_SESSION_PREFERUNATTACHED:
|
||||
case CMD_SESSION_WITHPANE:
|
||||
error = cmd_find_target(fs, item, target, CMD_FIND_SESSION,
|
||||
targetflags);
|
||||
if (error != 0)
|
||||
goto error;
|
||||
break;
|
||||
case CMD_MOVEW_R:
|
||||
error = cmd_find_target(fs, item, target, CMD_FIND_SESSION,
|
||||
CMD_FIND_QUIET);
|
||||
if (error == 0)
|
||||
break;
|
||||
/* FALLTHROUGH */
|
||||
case CMD_WINDOW:
|
||||
case CMD_WINDOW_CANFAIL:
|
||||
case CMD_WINDOW_MARKED:
|
||||
case CMD_WINDOW_INDEX:
|
||||
error = cmd_find_target(fs, item, target, CMD_FIND_WINDOW,
|
||||
targetflags);
|
||||
if (error != 0)
|
||||
goto error;
|
||||
break;
|
||||
case CMD_PANE:
|
||||
case CMD_PANE_CANFAIL:
|
||||
case CMD_PANE_MARKED:
|
||||
error = cmd_find_target(fs, item, target, CMD_FIND_PANE,
|
||||
targetflags);
|
||||
if (error != 0)
|
||||
goto error;
|
||||
break;
|
||||
default:
|
||||
fatalx("unknown %cflag %d", c, flag);
|
||||
}
|
||||
return (0);
|
||||
|
||||
error:
|
||||
if (~targetflags & CMD_FIND_QUIET)
|
||||
return (-1);
|
||||
cmd_find_clear_state(fs, 0);
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
cmd_prepare_state(struct cmd *cmd, struct cmdq_item *item)
|
||||
{
|
||||
const struct cmd_entry *entry = cmd->entry;
|
||||
struct cmd_state *state = &item->state;
|
||||
char *tmp;
|
||||
enum cmd_entry_flag flag;
|
||||
const char *s;
|
||||
int error;
|
||||
|
||||
tmp = cmd_print(cmd);
|
||||
log_debug("preparing state for %s (client %p)", tmp, item->client);
|
||||
free(tmp);
|
||||
|
||||
state->c = NULL;
|
||||
cmd_find_clear_state(&state->tflag, 0);
|
||||
cmd_find_clear_state(&state->sflag, 0);
|
||||
|
||||
flag = cmd->entry->cflag;
|
||||
if (flag == CMD_NONE) {
|
||||
flag = cmd->entry->tflag;
|
||||
if (flag == CMD_CLIENT || flag == CMD_CLIENT_CANFAIL)
|
||||
s = args_get(cmd->args, 't');
|
||||
else
|
||||
s = NULL;
|
||||
} else
|
||||
s = args_get(cmd->args, 'c');
|
||||
switch (flag) {
|
||||
case CMD_CLIENT:
|
||||
state->c = cmd_find_client(item, s, 0);
|
||||
if (state->c == NULL)
|
||||
return (-1);
|
||||
break;
|
||||
default:
|
||||
state->c = cmd_find_client(item, s, 1);
|
||||
break;
|
||||
}
|
||||
log_debug("using client %p", state->c);
|
||||
|
||||
s = args_get(cmd->args, 't');
|
||||
log_debug("preparing -t state: target %s", s == NULL ? "none" : s);
|
||||
|
||||
error = cmd_prepare_state_flag('t', s, entry->tflag, item);
|
||||
if (error != 0)
|
||||
return (error);
|
||||
|
||||
s = args_get(cmd->args, 's');
|
||||
log_debug("preparing -s state: target %s", s == NULL ? "none" : s);
|
||||
|
||||
error = cmd_prepare_state_flag('s', s, entry->sflag, item);
|
||||
if (error != 0)
|
||||
return (error);
|
||||
|
||||
if (!cmd_find_empty_state(&state->tflag) &&
|
||||
!cmd_find_valid_state(&state->tflag))
|
||||
fatalx("invalid -t state");
|
||||
if (!cmd_find_empty_state(&state->sflag) &&
|
||||
!cmd_find_valid_state(&state->sflag))
|
||||
fatalx("invalid -s state");
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
char *
|
||||
cmd_print(struct cmd *cmd)
|
||||
{
|
||||
|
@ -1113,7 +1113,7 @@ screen_write_collect_add(struct screen_write_ctx *ctx,
|
||||
*/
|
||||
|
||||
collect = 1;
|
||||
if (gc->data.width != 1)
|
||||
if (gc->data.width != 1 || gc->data.size != 1)
|
||||
collect = 0;
|
||||
else if (gc->attr & GRID_ATTR_CHARSET)
|
||||
collect = 0;
|
||||
|
@ -854,10 +854,9 @@ server_client_handle_key(struct client *c, key_code key)
|
||||
m->valid = 0;
|
||||
|
||||
/* Find affected pane. */
|
||||
if (KEYC_IS_MOUSE(key) && m->valid)
|
||||
wp = cmd_mouse_pane(m, NULL, NULL);
|
||||
else
|
||||
wp = w->active;
|
||||
if (!KEYC_IS_MOUSE(key) || cmd_find_from_mouse(&fs, m) != 0)
|
||||
cmd_find_from_session(&fs, s);
|
||||
wp = fs.wp;
|
||||
|
||||
/* Forward mouse keys if disabled. */
|
||||
if (KEYC_IS_MOUSE(key) && !options_get_number(s->options, "mouse"))
|
||||
@ -944,13 +943,8 @@ retry:
|
||||
}
|
||||
server_status_client(c);
|
||||
|
||||
/* Find default state if the pane is known. */
|
||||
if (KEYC_IS_MOUSE(key) && m->valid && wp != NULL) {
|
||||
cmd_find_from_winlink_pane(&fs, s->curw, wp);
|
||||
cmd_find_log_state(__func__, &fs);
|
||||
key_bindings_dispatch(bd, c, m, &fs);
|
||||
} else
|
||||
key_bindings_dispatch(bd, c, m, NULL);
|
||||
/* Execute the key binding. */
|
||||
key_bindings_dispatch(bd, c, m, &fs);
|
||||
key_bindings_unref_table(table);
|
||||
return;
|
||||
}
|
||||
|
52
tmux.h
52
tmux.h
@ -1166,13 +1166,7 @@ struct cmd_find_state {
|
||||
#define CMD_FIND_DEFAULT_MARKED 0x8
|
||||
#define CMD_FIND_EXACT_SESSION 0x10
|
||||
#define CMD_FIND_EXACT_WINDOW 0x20
|
||||
|
||||
/* Context for command being executed. */
|
||||
struct cmd_state {
|
||||
struct client *c;
|
||||
struct cmd_find_state tflag;
|
||||
struct cmd_find_state sflag;
|
||||
};
|
||||
#define CMD_FIND_CANFAIL 0x40
|
||||
|
||||
/* Command and list of commands. */
|
||||
struct cmd {
|
||||
@ -1241,40 +1235,24 @@ struct cmdq_item {
|
||||
#define CMDQ_NOHOOKS 0x4
|
||||
|
||||
struct cmdq_shared *shared;
|
||||
struct cmd_find_state source;
|
||||
struct cmd_find_state target;
|
||||
|
||||
struct cmd_list *cmdlist;
|
||||
struct cmd *cmd;
|
||||
|
||||
cmdq_cb cb;
|
||||
void *data;
|
||||
|
||||
struct cmd_state state;
|
||||
|
||||
TAILQ_ENTRY(cmdq_item) entry;
|
||||
};
|
||||
TAILQ_HEAD(cmdq_list, cmdq_item);
|
||||
|
||||
/* Command -c, -t or -s flags. */
|
||||
enum cmd_entry_flag {
|
||||
CMD_NONE,
|
||||
|
||||
CMD_CLIENT,
|
||||
CMD_CLIENT_CANFAIL,
|
||||
|
||||
CMD_SESSION,
|
||||
CMD_SESSION_CANFAIL,
|
||||
CMD_SESSION_PREFERUNATTACHED,
|
||||
CMD_SESSION_WITHPANE, /* implies PREFERUNATTACHED */
|
||||
|
||||
CMD_WINDOW,
|
||||
CMD_WINDOW_CANFAIL,
|
||||
CMD_WINDOW_MARKED,
|
||||
CMD_WINDOW_INDEX,
|
||||
|
||||
CMD_PANE,
|
||||
CMD_PANE_CANFAIL,
|
||||
CMD_PANE_MARKED,
|
||||
|
||||
CMD_MOVEW_R,
|
||||
/* Command definition flag. */
|
||||
struct cmd_entry_flag {
|
||||
char flag;
|
||||
enum cmd_find_type type;
|
||||
int flags;
|
||||
};
|
||||
|
||||
/* Command definition. */
|
||||
@ -1289,16 +1267,15 @@ struct cmd_entry {
|
||||
} args;
|
||||
const char *usage;
|
||||
|
||||
enum cmd_entry_flag tflag;
|
||||
enum cmd_entry_flag sflag;
|
||||
enum cmd_entry_flag cflag;
|
||||
struct cmd_entry_flag source;
|
||||
struct cmd_entry_flag target;
|
||||
|
||||
#define CMD_STARTSERVER 0x1
|
||||
#define CMD_READONLY 0x2
|
||||
#define CMD_AFTERHOOK 0x4
|
||||
int flags;
|
||||
|
||||
enum cmd_retval (*exec)(struct cmd *, struct cmdq_item *);
|
||||
enum cmd_retval (*exec)(struct cmd *, struct cmdq_item *);
|
||||
};
|
||||
|
||||
/* Client connection. */
|
||||
@ -1765,7 +1742,6 @@ char **cmd_copy_argv(int, char **);
|
||||
void cmd_free_argv(int, char **);
|
||||
char *cmd_stringify_argv(int, char **);
|
||||
struct cmd *cmd_parse(int, char **, const char *, u_int, char **);
|
||||
int cmd_prepare_state(struct cmd *, struct cmdq_item *);
|
||||
char *cmd_print(struct cmd *);
|
||||
int cmd_mouse_at(struct window_pane *, struct mouse_event *,
|
||||
u_int *, u_int *, int);
|
||||
@ -1776,8 +1752,8 @@ char *cmd_template_replace(const char *, const char *, int);
|
||||
extern const struct cmd_entry *cmd_table[];
|
||||
|
||||
/* cmd-attach-session.c */
|
||||
enum cmd_retval cmd_attach_session(struct cmdq_item *, int, int, const char *,
|
||||
int);
|
||||
enum cmd_retval cmd_attach_session(struct cmdq_item *, const char *, int, int,
|
||||
const char *, int);
|
||||
|
||||
/* cmd-list.c */
|
||||
struct cmd_list *cmd_list_parse(int, char **, const char *, u_int, char **);
|
||||
|
Loading…
Reference in New Issue
Block a user