mirror of
https://github.com/tmux/tmux.git
synced 2025-01-07 16:28:48 +00:00
Get rid of the extra layer of flags and cmd_prepare() and just store the
CMD_FIND_* flags in the cmd_entry and call it for the command. Commands with special requirements call it themselves and update the target for hooks to use.
This commit is contained in:
parent
2c0f826c36
commit
ee45a8a149
@ -40,21 +40,23 @@ const struct cmd_entry cmd_attach_session_entry = {
|
|||||||
.args = { "c:dErt:", 0, 0 },
|
.args = { "c:dErt:", 0, 0 },
|
||||||
.usage = "[-dEr] [-c working-directory] " CMD_TARGET_SESSION_USAGE,
|
.usage = "[-dEr] [-c working-directory] " CMD_TARGET_SESSION_USAGE,
|
||||||
|
|
||||||
.tflag = CMD_SESSION_WITHPANE,
|
/* -t is special */
|
||||||
|
|
||||||
.flags = CMD_STARTSERVER,
|
.flags = CMD_STARTSERVER,
|
||||||
.exec = cmd_attach_session_exec
|
.exec = cmd_attach_session_exec
|
||||||
};
|
};
|
||||||
|
|
||||||
enum cmd_retval
|
enum cmd_retval
|
||||||
cmd_attach_session(struct cmdq_item *item, int dflag, int rflag,
|
cmd_attach_session(struct cmdq_item *item, const char *tflag, int dflag,
|
||||||
const char *cflag, int Eflag)
|
int rflag, const char *cflag, int Eflag)
|
||||||
{
|
{
|
||||||
struct cmd_find_state *current = &item->shared->current;
|
struct cmd_find_state *current = &item->shared->current;
|
||||||
struct session *s = item->state.tflag.s;
|
enum cmd_find_type type;
|
||||||
|
int flags;
|
||||||
struct client *c = item->client, *c_loop;
|
struct client *c = item->client, *c_loop;
|
||||||
struct winlink *wl = item->state.tflag.wl;
|
struct session *s;
|
||||||
struct window_pane *wp = item->state.tflag.wp;
|
struct winlink *wl;
|
||||||
|
struct window_pane *wp;
|
||||||
char *cause;
|
char *cause;
|
||||||
|
|
||||||
if (RB_EMPTY(&sessions)) {
|
if (RB_EMPTY(&sessions)) {
|
||||||
@ -70,6 +72,19 @@ cmd_attach_session(struct cmdq_item *item, int dflag, int rflag,
|
|||||||
return (CMD_RETURN_ERROR);
|
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 (wl != NULL) {
|
||||||
if (wp != NULL)
|
if (wp != NULL)
|
||||||
window_set_active_pane(wp->window, wp);
|
window_set_active_pane(wp->window, wp);
|
||||||
@ -150,6 +165,7 @@ cmd_attach_session_exec(struct cmd *self, struct cmdq_item *item)
|
|||||||
{
|
{
|
||||||
struct args *args = self->args;
|
struct args *args = self->args;
|
||||||
|
|
||||||
return (cmd_attach_session(item, args_has(args, 'd'),
|
return (cmd_attach_session(item, args_get(args, 't'),
|
||||||
args_has(args, 'r'), args_get(args, 'c'), args_has(args, 'E')));
|
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",
|
.alias = "breakp",
|
||||||
|
|
||||||
.args = { "dPF:n:s:t:", 0, 0 },
|
.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,
|
.source = { 's', CMD_FIND_PANE, 0 },
|
||||||
.tflag = CMD_WINDOW_INDEX,
|
.target = { 't', CMD_FIND_WINDOW, CMD_FIND_WINDOW_INDEX },
|
||||||
|
|
||||||
.flags = 0,
|
.flags = 0,
|
||||||
.exec = cmd_break_pane_exec
|
.exec = cmd_break_pane_exec
|
||||||
@ -49,14 +50,14 @@ cmd_break_pane_exec(struct cmd *self, struct cmdq_item *item)
|
|||||||
{
|
{
|
||||||
struct args *args = self->args;
|
struct args *args = self->args;
|
||||||
struct cmd_find_state *current = &item->shared->current;
|
struct cmd_find_state *current = &item->shared->current;
|
||||||
struct client *c = item->state.c;
|
struct client *c = cmd_find_client(item, NULL, 1);
|
||||||
struct winlink *wl = item->state.sflag.wl;
|
struct winlink *wl = item->source.wl;
|
||||||
struct session *src_s = item->state.sflag.s;
|
struct session *src_s = item->source.s;
|
||||||
struct session *dst_s = item->state.tflag.s;
|
struct session *dst_s = item->target.s;
|
||||||
struct window_pane *wp = item->state.sflag.wp;
|
struct window_pane *wp = item->source.wp;
|
||||||
struct window *w = wl->window;
|
struct window *w = wl->window;
|
||||||
char *name, *cause;
|
char *name, *cause;
|
||||||
int idx = item->state.tflag.idx;
|
int idx = item->target.idx;
|
||||||
const char *template;
|
const char *template;
|
||||||
char *cp;
|
char *cp;
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ const struct cmd_entry cmd_capture_pane_entry = {
|
|||||||
.usage = "[-aCeJpPq] " CMD_BUFFER_USAGE " [-E end-line] "
|
.usage = "[-aCeJpPq] " CMD_BUFFER_USAGE " [-E end-line] "
|
||||||
"[-S start-line]" CMD_TARGET_PANE_USAGE,
|
"[-S start-line]" CMD_TARGET_PANE_USAGE,
|
||||||
|
|
||||||
.tflag = CMD_PANE,
|
.target = { 't', CMD_FIND_PANE, 0 },
|
||||||
|
|
||||||
.flags = CMD_AFTERHOOK,
|
.flags = CMD_AFTERHOOK,
|
||||||
.exec = cmd_capture_pane_exec
|
.exec = cmd_capture_pane_exec
|
||||||
@ -56,7 +56,7 @@ const struct cmd_entry cmd_clear_history_entry = {
|
|||||||
.args = { "t:", 0, 0 },
|
.args = { "t:", 0, 0 },
|
||||||
.usage = CMD_TARGET_PANE_USAGE,
|
.usage = CMD_TARGET_PANE_USAGE,
|
||||||
|
|
||||||
.tflag = CMD_PANE,
|
.target = { 't', CMD_FIND_PANE, 0 },
|
||||||
|
|
||||||
.flags = CMD_AFTERHOOK,
|
.flags = CMD_AFTERHOOK,
|
||||||
.exec = cmd_capture_pane_exec
|
.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 args *args = self->args;
|
||||||
struct client *c;
|
struct client *c;
|
||||||
struct window_pane *wp = item->state.tflag.wp;
|
struct window_pane *wp = item->target.wp;
|
||||||
char *buf, *cause;
|
char *buf, *cause;
|
||||||
const char *bufname;
|
const char *bufname;
|
||||||
size_t len;
|
size_t len;
|
||||||
|
@ -40,7 +40,7 @@ const struct cmd_entry cmd_choose_buffer_entry = {
|
|||||||
.args = { "F:t:", 0, 1 },
|
.args = { "F:t:", 0, 1 },
|
||||||
.usage = CMD_TARGET_WINDOW_USAGE " [-F format] [template]",
|
.usage = CMD_TARGET_WINDOW_USAGE " [-F format] [template]",
|
||||||
|
|
||||||
.tflag = CMD_WINDOW,
|
.target = { 't', CMD_FIND_WINDOW, 0 },
|
||||||
|
|
||||||
.flags = 0,
|
.flags = 0,
|
||||||
.exec = cmd_choose_buffer_exec
|
.exec = cmd_choose_buffer_exec
|
||||||
@ -50,8 +50,8 @@ static enum cmd_retval
|
|||||||
cmd_choose_buffer_exec(struct cmd *self, struct cmdq_item *item)
|
cmd_choose_buffer_exec(struct cmd *self, struct cmdq_item *item)
|
||||||
{
|
{
|
||||||
struct args *args = self->args;
|
struct args *args = self->args;
|
||||||
struct client *c = item->state.c;
|
struct client *c = cmd_find_client(item, NULL, 1);
|
||||||
struct winlink *wl = item->state.tflag.wl;
|
struct winlink *wl = item->target.wl;
|
||||||
struct window_choose_data *cdata;
|
struct window_choose_data *cdata;
|
||||||
struct paste_buffer *pb;
|
struct paste_buffer *pb;
|
||||||
char *action, *action_data;
|
char *action, *action_data;
|
||||||
|
@ -45,7 +45,7 @@ const struct cmd_entry cmd_choose_client_entry = {
|
|||||||
.args = { "F:t:", 0, 1 },
|
.args = { "F:t:", 0, 1 },
|
||||||
.usage = CMD_TARGET_WINDOW_USAGE " [-F format] [template]",
|
.usage = CMD_TARGET_WINDOW_USAGE " [-F format] [template]",
|
||||||
|
|
||||||
.tflag = CMD_WINDOW,
|
.target = { 't', CMD_FIND_WINDOW, 0 },
|
||||||
|
|
||||||
.flags = 0,
|
.flags = 0,
|
||||||
.exec = cmd_choose_client_exec
|
.exec = cmd_choose_client_exec
|
||||||
@ -59,10 +59,10 @@ static enum cmd_retval
|
|||||||
cmd_choose_client_exec(struct cmd *self, struct cmdq_item *item)
|
cmd_choose_client_exec(struct cmd *self, struct cmdq_item *item)
|
||||||
{
|
{
|
||||||
struct args *args = self->args;
|
struct args *args = self->args;
|
||||||
struct client *c = item->state.c;
|
struct client *c = cmd_find_client(item, NULL, 1);
|
||||||
struct client *c1;
|
struct client *c1;
|
||||||
struct window_choose_data *cdata;
|
struct window_choose_data *cdata;
|
||||||
struct winlink *wl = item->state.tflag.wl;
|
struct winlink *wl = item->target.wl;
|
||||||
const char *template;
|
const char *template;
|
||||||
char *action;
|
char *action;
|
||||||
u_int idx, cur;
|
u_int idx, cur;
|
||||||
|
@ -51,7 +51,7 @@ const struct cmd_entry cmd_choose_tree_entry = {
|
|||||||
.usage = "[-suw] [-b session-template] [-c window template] "
|
.usage = "[-suw] [-b session-template] [-c window template] "
|
||||||
"[-S format] [-W format] " CMD_TARGET_WINDOW_USAGE,
|
"[-S format] [-W format] " CMD_TARGET_WINDOW_USAGE,
|
||||||
|
|
||||||
.tflag = CMD_WINDOW,
|
.target = { 't', CMD_FIND_WINDOW, 0 },
|
||||||
|
|
||||||
.flags = 0,
|
.flags = 0,
|
||||||
.exec = cmd_choose_tree_exec
|
.exec = cmd_choose_tree_exec
|
||||||
@ -64,7 +64,7 @@ const struct cmd_entry cmd_choose_session_entry = {
|
|||||||
.args = { "F:t:", 0, 1 },
|
.args = { "F:t:", 0, 1 },
|
||||||
.usage = CMD_TARGET_WINDOW_USAGE " [-F format] [template]",
|
.usage = CMD_TARGET_WINDOW_USAGE " [-F format] [template]",
|
||||||
|
|
||||||
.tflag = CMD_WINDOW,
|
.target = { 't', CMD_FIND_WINDOW, 0 },
|
||||||
|
|
||||||
.flags = 0,
|
.flags = 0,
|
||||||
.exec = cmd_choose_tree_exec
|
.exec = cmd_choose_tree_exec
|
||||||
@ -77,7 +77,7 @@ const struct cmd_entry cmd_choose_window_entry = {
|
|||||||
.args = { "F:t:", 0, 1 },
|
.args = { "F:t:", 0, 1 },
|
||||||
.usage = CMD_TARGET_WINDOW_USAGE "[-F format] [template]",
|
.usage = CMD_TARGET_WINDOW_USAGE "[-F format] [template]",
|
||||||
|
|
||||||
.tflag = CMD_WINDOW,
|
.target = { 't', CMD_FIND_WINDOW, 0 },
|
||||||
|
|
||||||
.flags = 0,
|
.flags = 0,
|
||||||
.exec = cmd_choose_tree_exec
|
.exec = cmd_choose_tree_exec
|
||||||
@ -87,9 +87,9 @@ static enum cmd_retval
|
|||||||
cmd_choose_tree_exec(struct cmd *self, struct cmdq_item *item)
|
cmd_choose_tree_exec(struct cmd *self, struct cmdq_item *item)
|
||||||
{
|
{
|
||||||
struct args *args = self->args;
|
struct args *args = self->args;
|
||||||
struct client *c = item->state.c;
|
struct client *c = cmd_find_client(item, NULL, 1);
|
||||||
struct winlink *wl = item->state.tflag.wl, *wm;
|
struct winlink *wl = item->target.wl, *wm;
|
||||||
struct session *s = item->state.tflag.s, *s2;
|
struct session *s = item->target.s, *s2;
|
||||||
struct window_choose_data *wcd = NULL;
|
struct window_choose_data *wcd = NULL;
|
||||||
const char *ses_template, *win_template;
|
const char *ses_template, *win_template;
|
||||||
char *final_win_action, *cur_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 " "
|
.usage = "[-1Ni] [-I inputs] [-p prompts] " CMD_TARGET_CLIENT_USAGE " "
|
||||||
"[template]",
|
"[template]",
|
||||||
|
|
||||||
.tflag = CMD_CLIENT,
|
|
||||||
|
|
||||||
.flags = 0,
|
.flags = 0,
|
||||||
.exec = cmd_command_prompt_exec
|
.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;
|
struct args *args = self->args;
|
||||||
const char *inputs, *prompts;
|
const char *inputs, *prompts;
|
||||||
struct cmd_command_prompt_cdata *cdata;
|
struct cmd_command_prompt_cdata *cdata;
|
||||||
struct client *c = item->state.c;
|
struct client *c;
|
||||||
char *prompt, *ptr, *input = NULL;
|
char *prompt, *ptr, *input = NULL;
|
||||||
size_t n;
|
size_t n;
|
||||||
|
|
||||||
|
if ((c = cmd_find_client(item, args_get(args, 't'), 0)) == NULL)
|
||||||
|
return (CMD_RETURN_ERROR);
|
||||||
|
|
||||||
if (c->prompt_string != NULL)
|
if (c->prompt_string != NULL)
|
||||||
return (CMD_RETURN_NORMAL);
|
return (CMD_RETURN_NORMAL);
|
||||||
|
|
||||||
|
@ -41,8 +41,6 @@ const struct cmd_entry cmd_confirm_before_entry = {
|
|||||||
.args = { "p:t:", 1, 1 },
|
.args = { "p:t:", 1, 1 },
|
||||||
.usage = "[-p prompt] " CMD_TARGET_CLIENT_USAGE " command",
|
.usage = "[-p prompt] " CMD_TARGET_CLIENT_USAGE " command",
|
||||||
|
|
||||||
.tflag = CMD_CLIENT,
|
|
||||||
|
|
||||||
.flags = 0,
|
.flags = 0,
|
||||||
.exec = cmd_confirm_before_exec
|
.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 args *args = self->args;
|
||||||
struct cmd_confirm_before_data *cdata;
|
struct cmd_confirm_before_data *cdata;
|
||||||
struct client *c = item->state.c;
|
struct client *c;
|
||||||
char *cmd, *copy, *new_prompt, *ptr;
|
char *cmd, *copy, *new_prompt, *ptr;
|
||||||
const char *prompt;
|
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)
|
if ((prompt = args_get(args, 'p')) != NULL)
|
||||||
xasprintf(&new_prompt, "%s ", prompt);
|
xasprintf(&new_prompt, "%s ", prompt);
|
||||||
else {
|
else {
|
||||||
|
@ -33,7 +33,7 @@ const struct cmd_entry cmd_copy_mode_entry = {
|
|||||||
.args = { "Met:u", 0, 0 },
|
.args = { "Met:u", 0, 0 },
|
||||||
.usage = "[-Mu] " CMD_TARGET_PANE_USAGE,
|
.usage = "[-Mu] " CMD_TARGET_PANE_USAGE,
|
||||||
|
|
||||||
.tflag = CMD_PANE,
|
.target = { 't', CMD_FIND_PANE, 0 },
|
||||||
|
|
||||||
.flags = CMD_AFTERHOOK,
|
.flags = CMD_AFTERHOOK,
|
||||||
.exec = cmd_copy_mode_exec
|
.exec = cmd_copy_mode_exec
|
||||||
@ -46,7 +46,7 @@ const struct cmd_entry cmd_clock_mode_entry = {
|
|||||||
.args = { "t:", 0, 0 },
|
.args = { "t:", 0, 0 },
|
||||||
.usage = CMD_TARGET_PANE_USAGE,
|
.usage = CMD_TARGET_PANE_USAGE,
|
||||||
|
|
||||||
.tflag = CMD_PANE,
|
.target = { 't', CMD_FIND_PANE, 0 },
|
||||||
|
|
||||||
.flags = CMD_AFTERHOOK,
|
.flags = CMD_AFTERHOOK,
|
||||||
.exec = cmd_copy_mode_exec
|
.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 cmdq_shared *shared = item->shared;
|
||||||
struct client *c = item->client;
|
struct client *c = item->client;
|
||||||
struct session *s;
|
struct session *s;
|
||||||
struct window_pane *wp = item->state.tflag.wp;
|
struct window_pane *wp = item->target.wp;
|
||||||
|
|
||||||
if (args_has(args, 'M')) {
|
if (args_has(args, 'M')) {
|
||||||
if ((wp = cmd_mouse_pane(&shared->mouse, &s, NULL)) == NULL)
|
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] "
|
.usage = "[-aP] [-E shell-command] "
|
||||||
"[-s target-session] " CMD_TARGET_CLIENT_USAGE,
|
"[-s target-session] " CMD_TARGET_CLIENT_USAGE,
|
||||||
|
|
||||||
.sflag = CMD_SESSION,
|
.source = { 's', CMD_FIND_SESSION, CMD_FIND_CANFAIL },
|
||||||
.tflag = CMD_CLIENT,
|
|
||||||
|
|
||||||
.flags = CMD_READONLY,
|
.flags = CMD_READONLY,
|
||||||
.exec = cmd_detach_client_exec
|
.exec = cmd_detach_client_exec
|
||||||
@ -51,8 +50,6 @@ const struct cmd_entry cmd_suspend_client_entry = {
|
|||||||
.args = { "t:", 0, 0 },
|
.args = { "t:", 0, 0 },
|
||||||
.usage = CMD_TARGET_CLIENT_USAGE,
|
.usage = CMD_TARGET_CLIENT_USAGE,
|
||||||
|
|
||||||
.tflag = CMD_CLIENT,
|
|
||||||
|
|
||||||
.flags = 0,
|
.flags = 0,
|
||||||
.exec = cmd_detach_client_exec
|
.exec = cmd_detach_client_exec
|
||||||
};
|
};
|
||||||
@ -61,11 +58,14 @@ static enum cmd_retval
|
|||||||
cmd_detach_client_exec(struct cmd *self, struct cmdq_item *item)
|
cmd_detach_client_exec(struct cmd *self, struct cmdq_item *item)
|
||||||
{
|
{
|
||||||
struct args *args = self->args;
|
struct args *args = self->args;
|
||||||
struct client *c = item->state.c, *cloop;
|
struct client *c, *cloop;
|
||||||
struct session *s;
|
struct session *s;
|
||||||
enum msgtype msgtype;
|
enum msgtype msgtype;
|
||||||
const char *cmd = args_get(args, 'E');
|
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) {
|
if (self->entry == &cmd_suspend_client_entry) {
|
||||||
server_client_suspend(c);
|
server_client_suspend(c);
|
||||||
return (CMD_RETURN_NORMAL);
|
return (CMD_RETURN_NORMAL);
|
||||||
@ -77,7 +77,9 @@ cmd_detach_client_exec(struct cmd *self, struct cmdq_item *item)
|
|||||||
msgtype = MSG_DETACH;
|
msgtype = MSG_DETACH;
|
||||||
|
|
||||||
if (args_has(args, 's')) {
|
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) {
|
TAILQ_FOREACH(cloop, &clients, entry) {
|
||||||
if (cloop->session == s) {
|
if (cloop->session == s) {
|
||||||
if (cmd != NULL)
|
if (cmd != NULL)
|
||||||
|
@ -43,8 +43,7 @@ const struct cmd_entry cmd_display_message_entry = {
|
|||||||
.usage = "[-p] [-c target-client] [-F format] "
|
.usage = "[-p] [-c target-client] [-F format] "
|
||||||
CMD_TARGET_PANE_USAGE " [message]",
|
CMD_TARGET_PANE_USAGE " [message]",
|
||||||
|
|
||||||
.cflag = CMD_CLIENT_CANFAIL,
|
.target = { 't', CMD_FIND_PANE, 0 },
|
||||||
.tflag = CMD_PANE,
|
|
||||||
|
|
||||||
.flags = CMD_AFTERHOOK,
|
.flags = CMD_AFTERHOOK,
|
||||||
.exec = cmd_display_message_exec
|
.exec = cmd_display_message_exec
|
||||||
@ -54,10 +53,10 @@ static enum cmd_retval
|
|||||||
cmd_display_message_exec(struct cmd *self, struct cmdq_item *item)
|
cmd_display_message_exec(struct cmd *self, struct cmdq_item *item)
|
||||||
{
|
{
|
||||||
struct args *args = self->args;
|
struct args *args = self->args;
|
||||||
struct client *c = item->state.c;
|
struct client *c;
|
||||||
struct session *s = item->state.tflag.s;
|
struct session *s = item->target.s;
|
||||||
struct winlink *wl = item->state.tflag.wl;
|
struct winlink *wl = item->target.wl;
|
||||||
struct window_pane *wp = item->state.tflag.wp;
|
struct window_pane *wp = item->target.wp;
|
||||||
const char *template;
|
const char *template;
|
||||||
char *msg;
|
char *msg;
|
||||||
struct format_tree *ft;
|
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");
|
cmdq_error(item, "only one of -F or argument must be given");
|
||||||
return (CMD_RETURN_ERROR);
|
return (CMD_RETURN_ERROR);
|
||||||
}
|
}
|
||||||
|
c = cmd_find_client(item, args_get(args, 'c'), 1);
|
||||||
|
|
||||||
template = args_get(args, 'F');
|
template = args_get(args, 'F');
|
||||||
if (args->argc != 0)
|
if (args->argc != 0)
|
||||||
|
@ -40,8 +40,6 @@ const struct cmd_entry cmd_display_panes_entry = {
|
|||||||
.args = { "t:", 0, 1 },
|
.args = { "t:", 0, 1 },
|
||||||
.usage = CMD_TARGET_CLIENT_USAGE,
|
.usage = CMD_TARGET_CLIENT_USAGE,
|
||||||
|
|
||||||
.tflag = CMD_CLIENT,
|
|
||||||
|
|
||||||
.flags = CMD_AFTERHOOK,
|
.flags = CMD_AFTERHOOK,
|
||||||
.exec = cmd_display_panes_exec
|
.exec = cmd_display_panes_exec
|
||||||
};
|
};
|
||||||
@ -50,7 +48,10 @@ static enum cmd_retval
|
|||||||
cmd_display_panes_exec(struct cmd *self, struct cmdq_item *item)
|
cmd_display_panes_exec(struct cmd *self, struct cmdq_item *item)
|
||||||
{
|
{
|
||||||
struct args *args = self->args;
|
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)
|
if (c->identify_callback != NULL)
|
||||||
return (CMD_RETURN_NORMAL);
|
return (CMD_RETURN_NORMAL);
|
||||||
|
@ -54,7 +54,7 @@ const struct cmd_entry cmd_find_window_entry = {
|
|||||||
.args = { "F:CNt:T", 1, 4 },
|
.args = { "F:CNt:T", 1, 4 },
|
||||||
.usage = "[-CNT] [-F format] " CMD_TARGET_WINDOW_USAGE " match-string",
|
.usage = "[-CNT] [-F format] " CMD_TARGET_WINDOW_USAGE " match-string",
|
||||||
|
|
||||||
.tflag = CMD_WINDOW,
|
.target = { 't', CMD_FIND_WINDOW, 0 },
|
||||||
|
|
||||||
.flags = 0,
|
.flags = 0,
|
||||||
.exec = cmd_find_window_exec
|
.exec = cmd_find_window_exec
|
||||||
@ -143,10 +143,10 @@ cmd_find_window_exec(struct cmd *self, struct cmdq_item *item)
|
|||||||
{
|
{
|
||||||
struct args *args = self->args;
|
struct args *args = self->args;
|
||||||
struct cmd_find_state *current = &item->shared->current;
|
struct cmd_find_state *current = &item->shared->current;
|
||||||
struct client *c = item->state.c;
|
struct client *c = cmd_find_client(item, NULL, 1);
|
||||||
struct window_choose_data *cdata;
|
struct window_choose_data *cdata;
|
||||||
struct session *s = item->state.tflag.s;
|
struct session *s = item->target.s;
|
||||||
struct winlink *wl = item->state.tflag.wl, *wm;
|
struct winlink *wl = item->target.wl, *wm;
|
||||||
struct cmd_find_window_list find_list;
|
struct cmd_find_window_list find_list;
|
||||||
struct cmd_find_window_data *find_data;
|
struct cmd_find_window_data *find_data;
|
||||||
struct cmd_find_window_data *find_data1;
|
struct cmd_find_window_data *find_data1;
|
||||||
|
@ -953,6 +953,10 @@ cmd_find_target(struct cmd_find_state *fs, struct cmdq_item *item,
|
|||||||
const char *session, *window, *pane;
|
const char *session, *window, *pane;
|
||||||
int window_only = 0, pane_only = 0;
|
int window_only = 0, pane_only = 0;
|
||||||
|
|
||||||
|
/* Can fail flag implies quiet. */
|
||||||
|
if (flags & CMD_FIND_CANFAIL)
|
||||||
|
flags |= CMD_FIND_QUIET;
|
||||||
|
|
||||||
/* Log the arguments. */
|
/* Log the arguments. */
|
||||||
if (target == NULL)
|
if (target == NULL)
|
||||||
log_debug("%s: target none, type %d", __func__, type);
|
log_debug("%s: target none, type %d", __func__, type);
|
||||||
@ -1190,6 +1194,8 @@ error:
|
|||||||
log_debug("%s: error", __func__);
|
log_debug("%s: error", __func__);
|
||||||
|
|
||||||
free(copy);
|
free(copy);
|
||||||
|
if (flags & CMD_FIND_CANFAIL)
|
||||||
|
return (0);
|
||||||
return (-1);
|
return (-1);
|
||||||
|
|
||||||
found:
|
found:
|
||||||
|
@ -43,7 +43,7 @@ const struct cmd_entry cmd_if_shell_entry = {
|
|||||||
.usage = "[-bF] " CMD_TARGET_PANE_USAGE " shell-command command "
|
.usage = "[-bF] " CMD_TARGET_PANE_USAGE " shell-command command "
|
||||||
"[command]",
|
"[command]",
|
||||||
|
|
||||||
.tflag = CMD_PANE_CANFAIL,
|
.target = { 't', CMD_FIND_PANE, CMD_FIND_CANFAIL },
|
||||||
|
|
||||||
.flags = 0,
|
.flags = 0,
|
||||||
.exec = cmd_if_shell_exec
|
.exec = cmd_if_shell_exec
|
||||||
@ -70,10 +70,10 @@ cmd_if_shell_exec(struct cmd *self, struct cmdq_item *item)
|
|||||||
char *shellcmd, *cmd, *cause;
|
char *shellcmd, *cmd, *cause;
|
||||||
struct cmd_list *cmdlist;
|
struct cmd_list *cmdlist;
|
||||||
struct cmdq_item *new_item;
|
struct cmdq_item *new_item;
|
||||||
struct client *c = item->state.c;
|
struct client *c = cmd_find_client(item, NULL, 1);
|
||||||
struct session *s = item->state.tflag.s;
|
struct session *s = item->target.s;
|
||||||
struct winlink *wl = item->state.tflag.wl;
|
struct winlink *wl = item->target.wl;
|
||||||
struct window_pane *wp = item->state.tflag.wp;
|
struct window_pane *wp = item->target.wp;
|
||||||
const char *cwd;
|
const char *cwd;
|
||||||
|
|
||||||
if (item->client != NULL && item->client->session == NULL)
|
if (item->client != NULL && item->client->session == NULL)
|
||||||
|
@ -38,8 +38,8 @@ const struct cmd_entry cmd_join_pane_entry = {
|
|||||||
.args = { "bdhvp:l:s:t:", 0, 0 },
|
.args = { "bdhvp:l:s:t:", 0, 0 },
|
||||||
.usage = "[-bdhv] [-p percentage|-l size] " CMD_SRCDST_PANE_USAGE,
|
.usage = "[-bdhv] [-p percentage|-l size] " CMD_SRCDST_PANE_USAGE,
|
||||||
|
|
||||||
.sflag = CMD_PANE_MARKED,
|
.source = { 's', CMD_FIND_PANE, CMD_FIND_DEFAULT_MARKED },
|
||||||
.tflag = CMD_PANE,
|
.target = { 't', CMD_FIND_PANE, 0 },
|
||||||
|
|
||||||
.flags = 0,
|
.flags = 0,
|
||||||
.exec = cmd_join_pane_exec
|
.exec = cmd_join_pane_exec
|
||||||
@ -52,8 +52,8 @@ const struct cmd_entry cmd_move_pane_entry = {
|
|||||||
.args = { "bdhvp:l:s:t:", 0, 0 },
|
.args = { "bdhvp:l:s:t:", 0, 0 },
|
||||||
.usage = "[-bdhv] [-p percentage|-l size] " CMD_SRCDST_PANE_USAGE,
|
.usage = "[-bdhv] [-p percentage|-l size] " CMD_SRCDST_PANE_USAGE,
|
||||||
|
|
||||||
.sflag = CMD_PANE,
|
.source = { 's', CMD_FIND_PANE, 0 },
|
||||||
.tflag = CMD_PANE,
|
.target = { 't', CMD_FIND_PANE, 0 },
|
||||||
|
|
||||||
.flags = 0,
|
.flags = 0,
|
||||||
.exec = cmd_join_pane_exec
|
.exec = cmd_join_pane_exec
|
||||||
@ -79,15 +79,15 @@ cmd_join_pane_exec(struct cmd *self, struct cmdq_item *item)
|
|||||||
else
|
else
|
||||||
not_same_window = 0;
|
not_same_window = 0;
|
||||||
|
|
||||||
dst_s = item->state.tflag.s;
|
dst_s = item->target.s;
|
||||||
dst_wl = item->state.tflag.wl;
|
dst_wl = item->target.wl;
|
||||||
dst_wp = item->state.tflag.wp;
|
dst_wp = item->target.wp;
|
||||||
dst_w = dst_wl->window;
|
dst_w = dst_wl->window;
|
||||||
dst_idx = dst_wl->idx;
|
dst_idx = dst_wl->idx;
|
||||||
server_unzoom_window(dst_w);
|
server_unzoom_window(dst_w);
|
||||||
|
|
||||||
src_wl = item->state.sflag.wl;
|
src_wl = item->source.wl;
|
||||||
src_wp = item->state.sflag.wp;
|
src_wp = item->source.wp;
|
||||||
src_w = src_wl->window;
|
src_w = src_wl->window;
|
||||||
server_unzoom_window(src_w);
|
server_unzoom_window(src_w);
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ const struct cmd_entry cmd_kill_pane_entry = {
|
|||||||
.args = { "at:", 0, 0 },
|
.args = { "at:", 0, 0 },
|
||||||
.usage = "[-a] " CMD_TARGET_PANE_USAGE,
|
.usage = "[-a] " CMD_TARGET_PANE_USAGE,
|
||||||
|
|
||||||
.tflag = CMD_PANE,
|
.target = { 't', CMD_FIND_PANE, 0 },
|
||||||
|
|
||||||
.flags = 0,
|
.flags = 0,
|
||||||
.exec = cmd_kill_pane_exec
|
.exec = cmd_kill_pane_exec
|
||||||
@ -44,8 +44,8 @@ const struct cmd_entry cmd_kill_pane_entry = {
|
|||||||
static enum cmd_retval
|
static enum cmd_retval
|
||||||
cmd_kill_pane_exec(struct cmd *self, struct cmdq_item *item)
|
cmd_kill_pane_exec(struct cmd *self, struct cmdq_item *item)
|
||||||
{
|
{
|
||||||
struct winlink *wl = item->state.tflag.wl;
|
struct winlink *wl = item->target.wl;
|
||||||
struct window_pane *loopwp, *tmpwp, *wp = item->state.tflag.wp;
|
struct window_pane *loopwp, *tmpwp, *wp = item->target.wp;
|
||||||
|
|
||||||
server_unzoom_window(wl->window);
|
server_unzoom_window(wl->window);
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ const struct cmd_entry cmd_kill_session_entry = {
|
|||||||
.args = { "aCt:", 0, 0 },
|
.args = { "aCt:", 0, 0 },
|
||||||
.usage = "[-aC] " CMD_TARGET_SESSION_USAGE,
|
.usage = "[-aC] " CMD_TARGET_SESSION_USAGE,
|
||||||
|
|
||||||
.tflag = CMD_SESSION,
|
.target = { 't', CMD_FIND_SESSION, 0 },
|
||||||
|
|
||||||
.flags = 0,
|
.flags = 0,
|
||||||
.exec = cmd_kill_session_exec
|
.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 session *s, *sloop, *stmp;
|
||||||
struct winlink *wl;
|
struct winlink *wl;
|
||||||
|
|
||||||
s = item->state.tflag.s;
|
s = item->target.s;
|
||||||
|
|
||||||
if (args_has(args, 'C')) {
|
if (args_has(args, 'C')) {
|
||||||
RB_FOREACH(wl, winlinks, &s->windows) {
|
RB_FOREACH(wl, winlinks, &s->windows) {
|
||||||
|
@ -33,7 +33,7 @@ const struct cmd_entry cmd_kill_window_entry = {
|
|||||||
.args = { "at:", 0, 0 },
|
.args = { "at:", 0, 0 },
|
||||||
.usage = "[-a] " CMD_TARGET_WINDOW_USAGE,
|
.usage = "[-a] " CMD_TARGET_WINDOW_USAGE,
|
||||||
|
|
||||||
.tflag = CMD_WINDOW,
|
.target = { 't', CMD_FIND_WINDOW, 0 },
|
||||||
|
|
||||||
.flags = 0,
|
.flags = 0,
|
||||||
.exec = cmd_kill_window_exec
|
.exec = cmd_kill_window_exec
|
||||||
@ -46,7 +46,7 @@ const struct cmd_entry cmd_unlink_window_entry = {
|
|||||||
.args = { "kt:", 0, 0 },
|
.args = { "kt:", 0, 0 },
|
||||||
.usage = "[-k] " CMD_TARGET_WINDOW_USAGE,
|
.usage = "[-k] " CMD_TARGET_WINDOW_USAGE,
|
||||||
|
|
||||||
.tflag = CMD_WINDOW,
|
.target = { 't', CMD_FIND_WINDOW, 0 },
|
||||||
|
|
||||||
.flags = 0,
|
.flags = 0,
|
||||||
.exec = cmd_kill_window_exec
|
.exec = cmd_kill_window_exec
|
||||||
@ -56,9 +56,9 @@ static enum cmd_retval
|
|||||||
cmd_kill_window_exec(struct cmd *self, struct cmdq_item *item)
|
cmd_kill_window_exec(struct cmd *self, struct cmdq_item *item)
|
||||||
{
|
{
|
||||||
struct args *args = self->args;
|
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 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 (self->entry == &cmd_unlink_window_entry) {
|
||||||
if (!args_has(self->args, 'k') && !session_is_linked(s, w)) {
|
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 },
|
.args = { "F:t:", 0, 0 },
|
||||||
.usage = "[-F format] " CMD_TARGET_SESSION_USAGE,
|
.usage = "[-F format] " CMD_TARGET_SESSION_USAGE,
|
||||||
|
|
||||||
.tflag = CMD_SESSION,
|
.target = { 't', CMD_FIND_SESSION, 0 },
|
||||||
|
|
||||||
.flags = CMD_READONLY|CMD_AFTERHOOK,
|
.flags = CMD_READONLY|CMD_AFTERHOOK,
|
||||||
.exec = cmd_list_clients_exec
|
.exec = cmd_list_clients_exec
|
||||||
@ -60,7 +60,7 @@ cmd_list_clients_exec(struct cmd *self, struct cmdq_item *item)
|
|||||||
char *line;
|
char *line;
|
||||||
|
|
||||||
if (args_has(args, 't'))
|
if (args_has(args, 't'))
|
||||||
s = item->state.tflag.s;
|
s = item->target.s;
|
||||||
else
|
else
|
||||||
s = NULL;
|
s = NULL;
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ const struct cmd_entry cmd_list_panes_entry = {
|
|||||||
.args = { "asF:t:", 0, 0 },
|
.args = { "asF:t:", 0, 0 },
|
||||||
.usage = "[-as] [-F format] " CMD_TARGET_WINDOW_USAGE,
|
.usage = "[-as] [-F format] " CMD_TARGET_WINDOW_USAGE,
|
||||||
|
|
||||||
.tflag = CMD_WINDOW,
|
.target = { 't', CMD_FIND_WINDOW, 0 },
|
||||||
|
|
||||||
.flags = CMD_AFTERHOOK,
|
.flags = CMD_AFTERHOOK,
|
||||||
.exec = cmd_list_panes_exec
|
.exec = cmd_list_panes_exec
|
||||||
@ -51,8 +51,8 @@ static enum cmd_retval
|
|||||||
cmd_list_panes_exec(struct cmd *self, struct cmdq_item *item)
|
cmd_list_panes_exec(struct cmd *self, struct cmdq_item *item)
|
||||||
{
|
{
|
||||||
struct args *args = self->args;
|
struct args *args = self->args;
|
||||||
struct session *s = item->state.tflag.s;
|
struct session *s = item->target.s;
|
||||||
struct winlink *wl = item->state.tflag.wl;
|
struct winlink *wl = item->target.wl;
|
||||||
|
|
||||||
if (args_has(args, 'a'))
|
if (args_has(args, 'a'))
|
||||||
cmd_list_panes_server(self, item);
|
cmd_list_panes_server(self, item);
|
||||||
|
@ -52,7 +52,7 @@ const struct cmd_entry cmd_list_windows_entry = {
|
|||||||
.args = { "F:at:", 0, 0 },
|
.args = { "F:at:", 0, 0 },
|
||||||
.usage = "[-a] [-F format] " CMD_TARGET_SESSION_USAGE,
|
.usage = "[-a] [-F format] " CMD_TARGET_SESSION_USAGE,
|
||||||
|
|
||||||
.tflag = CMD_SESSION,
|
.target = { 't', CMD_FIND_SESSION, 0 },
|
||||||
|
|
||||||
.flags = CMD_AFTERHOOK,
|
.flags = CMD_AFTERHOOK,
|
||||||
.exec = cmd_list_windows_exec
|
.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'))
|
if (args_has(args, 'a'))
|
||||||
cmd_list_windows_server(self, item);
|
cmd_list_windows_server(self, item);
|
||||||
else
|
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);
|
return (CMD_RETURN_NORMAL);
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,7 @@ const struct cmd_entry cmd_lock_session_entry = {
|
|||||||
.args = { "t:", 0, 0 },
|
.args = { "t:", 0, 0 },
|
||||||
.usage = CMD_TARGET_SESSION_USAGE,
|
.usage = CMD_TARGET_SESSION_USAGE,
|
||||||
|
|
||||||
.tflag = CMD_SESSION,
|
.target = { 't', CMD_FIND_SESSION, 0 },
|
||||||
|
|
||||||
.flags = CMD_AFTERHOOK,
|
.flags = CMD_AFTERHOOK,
|
||||||
.exec = cmd_lock_server_exec
|
.exec = cmd_lock_server_exec
|
||||||
@ -57,22 +57,25 @@ const struct cmd_entry cmd_lock_client_entry = {
|
|||||||
.args = { "t:", 0, 0 },
|
.args = { "t:", 0, 0 },
|
||||||
.usage = CMD_TARGET_CLIENT_USAGE,
|
.usage = CMD_TARGET_CLIENT_USAGE,
|
||||||
|
|
||||||
.tflag = CMD_CLIENT,
|
|
||||||
|
|
||||||
.flags = CMD_AFTERHOOK,
|
.flags = CMD_AFTERHOOK,
|
||||||
.exec = cmd_lock_server_exec
|
.exec = cmd_lock_server_exec
|
||||||
};
|
};
|
||||||
|
|
||||||
static enum cmd_retval
|
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)
|
if (self->entry == &cmd_lock_server_entry)
|
||||||
server_lock();
|
server_lock();
|
||||||
else if (self->entry == &cmd_lock_session_entry)
|
else if (self->entry == &cmd_lock_session_entry)
|
||||||
server_lock_session(item->state.tflag.s);
|
server_lock_session(item->target.s);
|
||||||
else
|
else {
|
||||||
server_lock_client(item->state.c);
|
if ((c = cmd_find_client(item, args_get(args, 't'), 0)) == NULL)
|
||||||
|
return (CMD_RETURN_ERROR);
|
||||||
|
server_lock_client(c);
|
||||||
|
}
|
||||||
recalculate_sizes();
|
recalculate_sizes();
|
||||||
|
|
||||||
return (CMD_RETURN_NORMAL);
|
return (CMD_RETURN_NORMAL);
|
||||||
|
@ -35,8 +35,8 @@ const struct cmd_entry cmd_move_window_entry = {
|
|||||||
.args = { "adkrs:t:", 0, 0 },
|
.args = { "adkrs:t:", 0, 0 },
|
||||||
.usage = "[-dkr] " CMD_SRCDST_WINDOW_USAGE,
|
.usage = "[-dkr] " CMD_SRCDST_WINDOW_USAGE,
|
||||||
|
|
||||||
.sflag = CMD_WINDOW,
|
.source = { 's', CMD_FIND_WINDOW, 0 },
|
||||||
.tflag = CMD_MOVEW_R,
|
/* -t is special */
|
||||||
|
|
||||||
.flags = 0,
|
.flags = 0,
|
||||||
.exec = cmd_move_window_exec
|
.exec = cmd_move_window_exec
|
||||||
@ -49,8 +49,8 @@ const struct cmd_entry cmd_link_window_entry = {
|
|||||||
.args = { "adks:t:", 0, 0 },
|
.args = { "adks:t:", 0, 0 },
|
||||||
.usage = "[-dk] " CMD_SRCDST_WINDOW_USAGE,
|
.usage = "[-dk] " CMD_SRCDST_WINDOW_USAGE,
|
||||||
|
|
||||||
.sflag = CMD_WINDOW,
|
.source = { 's', CMD_FIND_WINDOW, 0 },
|
||||||
.tflag = CMD_WINDOW_INDEX,
|
/* -t is special */
|
||||||
|
|
||||||
.flags = 0,
|
.flags = 0,
|
||||||
.exec = cmd_move_window_exec
|
.exec = cmd_move_window_exec
|
||||||
@ -60,18 +60,31 @@ static enum cmd_retval
|
|||||||
cmd_move_window_exec(struct cmd *self, struct cmdq_item *item)
|
cmd_move_window_exec(struct cmd *self, struct cmdq_item *item)
|
||||||
{
|
{
|
||||||
struct args *args = self->args;
|
struct args *args = self->args;
|
||||||
struct session *src = item->state.sflag.s;
|
const char *tflag = args_get(args, 't');
|
||||||
struct session *dst = item->state.tflag.s;
|
struct session *src;
|
||||||
struct winlink *wl = item->state.sflag.wl;
|
struct session *dst;
|
||||||
|
struct winlink *wl;
|
||||||
char *cause;
|
char *cause;
|
||||||
int idx = item->state.tflag.idx, kflag, dflag, sflag;
|
int idx, kflag, dflag, sflag;
|
||||||
|
|
||||||
if (args_has(args, 'r')) {
|
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();
|
recalculate_sizes();
|
||||||
|
server_status_session(item->target.s);
|
||||||
|
|
||||||
return (CMD_RETURN_NORMAL);
|
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');
|
kflag = args_has(self->args, 'k');
|
||||||
dflag = args_has(self->args, 'd');
|
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] "
|
"[-s session-name] " CMD_TARGET_SESSION_USAGE " [-x width] "
|
||||||
"[-y height] [command]",
|
"[-y height] [command]",
|
||||||
|
|
||||||
.tflag = CMD_SESSION_CANFAIL,
|
.target = { 't', CMD_FIND_SESSION, CMD_FIND_CANFAIL },
|
||||||
|
|
||||||
.flags = CMD_STARTSERVER,
|
.flags = CMD_STARTSERVER,
|
||||||
.exec = cmd_new_session_exec
|
.exec = cmd_new_session_exec
|
||||||
@ -57,7 +57,7 @@ const struct cmd_entry cmd_has_session_entry = {
|
|||||||
.args = { "t:", 0, 0 },
|
.args = { "t:", 0, 0 },
|
||||||
.usage = CMD_TARGET_SESSION_USAGE,
|
.usage = CMD_TARGET_SESSION_USAGE,
|
||||||
|
|
||||||
.tflag = CMD_SESSION,
|
.target = { 't', CMD_FIND_SESSION, 0 },
|
||||||
|
|
||||||
.flags = 0,
|
.flags = 0,
|
||||||
.exec = cmd_new_session_exec
|
.exec = cmd_new_session_exec
|
||||||
@ -108,10 +108,10 @@ cmd_new_session_exec(struct cmd *self, struct cmdq_item *item)
|
|||||||
* have already been prepared, copy this
|
* have already been prepared, copy this
|
||||||
* session into its tflag so it can be used.
|
* session into its tflag so it can be used.
|
||||||
*/
|
*/
|
||||||
cmd_find_from_session(&item->state.tflag, as);
|
cmd_find_from_session(&item->target, as);
|
||||||
return (cmd_attach_session(item,
|
return (cmd_attach_session(item,
|
||||||
args_has(args, 'D'), 0, NULL,
|
args_get(args, 't'), args_has(args, 'D'),
|
||||||
args_has(args, 'E')));
|
0, NULL, args_has(args, 'E')));
|
||||||
}
|
}
|
||||||
cmdq_error(item, "duplicate session: %s", newname);
|
cmdq_error(item, "duplicate session: %s", newname);
|
||||||
return (CMD_RETURN_ERROR);
|
return (CMD_RETURN_ERROR);
|
||||||
@ -121,7 +121,7 @@ cmd_new_session_exec(struct cmd *self, struct cmdq_item *item)
|
|||||||
/* Is this going to be part of a session group? */
|
/* Is this going to be part of a session group? */
|
||||||
group = args_get(args, 't');
|
group = args_get(args, 't');
|
||||||
if (group != NULL) {
|
if (group != NULL) {
|
||||||
groupwith = item->state.tflag.s;
|
groupwith = item->target.s;
|
||||||
if (groupwith == NULL) {
|
if (groupwith == NULL) {
|
||||||
if (!session_check_name(group)) {
|
if (!session_check_name(group)) {
|
||||||
cmdq_error(item, "bad group name: %s", group);
|
cmdq_error(item, "bad group name: %s", group);
|
||||||
|
@ -42,7 +42,7 @@ const struct cmd_entry cmd_new_window_entry = {
|
|||||||
.usage = "[-adkP] [-c start-directory] [-F format] [-n window-name] "
|
.usage = "[-adkP] [-c start-directory] [-F format] [-n window-name] "
|
||||||
CMD_TARGET_WINDOW_USAGE " [command]",
|
CMD_TARGET_WINDOW_USAGE " [command]",
|
||||||
|
|
||||||
.tflag = CMD_WINDOW_INDEX,
|
.target = { 't', CMD_FIND_WINDOW, CMD_FIND_WINDOW_INDEX },
|
||||||
|
|
||||||
.flags = 0,
|
.flags = 0,
|
||||||
.exec = cmd_new_window_exec
|
.exec = cmd_new_window_exec
|
||||||
@ -53,10 +53,10 @@ cmd_new_window_exec(struct cmd *self, struct cmdq_item *item)
|
|||||||
{
|
{
|
||||||
struct args *args = self->args;
|
struct args *args = self->args;
|
||||||
struct cmd_find_state *current = &item->shared->current;
|
struct cmd_find_state *current = &item->shared->current;
|
||||||
struct session *s = item->state.tflag.s;
|
struct session *s = item->target.s;
|
||||||
struct winlink *wl = item->state.tflag.wl;
|
struct winlink *wl = item->target.wl;
|
||||||
struct client *c = item->state.c;
|
struct client *c = cmd_find_client(item, NULL, 1);
|
||||||
int idx = item->state.tflag.idx;
|
int idx = item->target.idx;
|
||||||
const char *cmd, *path, *template, *cwd, *to_free;
|
const char *cmd, *path, *template, *cwd, *to_free;
|
||||||
char **argv, *cause, *cp;
|
char **argv, *cause, *cp;
|
||||||
int argc, detached;
|
int argc, detached;
|
||||||
|
@ -38,7 +38,7 @@ const struct cmd_entry cmd_paste_buffer_entry = {
|
|||||||
.usage = "[-dpr] [-s separator] " CMD_BUFFER_USAGE " "
|
.usage = "[-dpr] [-s separator] " CMD_BUFFER_USAGE " "
|
||||||
CMD_TARGET_PANE_USAGE,
|
CMD_TARGET_PANE_USAGE,
|
||||||
|
|
||||||
.tflag = CMD_PANE,
|
.target = { 't', CMD_FIND_PANE, 0 },
|
||||||
|
|
||||||
.flags = CMD_AFTERHOOK,
|
.flags = CMD_AFTERHOOK,
|
||||||
.exec = cmd_paste_buffer_exec
|
.exec = cmd_paste_buffer_exec
|
||||||
@ -48,7 +48,7 @@ static enum cmd_retval
|
|||||||
cmd_paste_buffer_exec(struct cmd *self, struct cmdq_item *item)
|
cmd_paste_buffer_exec(struct cmd *self, struct cmdq_item *item)
|
||||||
{
|
{
|
||||||
struct args *args = self->args;
|
struct args *args = self->args;
|
||||||
struct window_pane *wp = item->state.tflag.wp;
|
struct window_pane *wp = item->target.wp;
|
||||||
struct paste_buffer *pb;
|
struct paste_buffer *pb;
|
||||||
const char *sepstr, *bufname, *bufdata, *bufend, *line;
|
const char *sepstr, *bufname, *bufdata, *bufend, *line;
|
||||||
size_t seplen, bufsize;
|
size_t seplen, bufsize;
|
||||||
|
@ -44,7 +44,7 @@ const struct cmd_entry cmd_pipe_pane_entry = {
|
|||||||
.args = { "ot:", 0, 1 },
|
.args = { "ot:", 0, 1 },
|
||||||
.usage = "[-o] " CMD_TARGET_PANE_USAGE " [command]",
|
.usage = "[-o] " CMD_TARGET_PANE_USAGE " [command]",
|
||||||
|
|
||||||
.tflag = CMD_PANE,
|
.target = { 't', CMD_FIND_PANE, 0 },
|
||||||
|
|
||||||
.flags = CMD_AFTERHOOK,
|
.flags = CMD_AFTERHOOK,
|
||||||
.exec = cmd_pipe_pane_exec
|
.exec = cmd_pipe_pane_exec
|
||||||
@ -54,10 +54,10 @@ static enum cmd_retval
|
|||||||
cmd_pipe_pane_exec(struct cmd *self, struct cmdq_item *item)
|
cmd_pipe_pane_exec(struct cmd *self, struct cmdq_item *item)
|
||||||
{
|
{
|
||||||
struct args *args = self->args;
|
struct args *args = self->args;
|
||||||
struct client *c = item->state.c;
|
struct client *c = cmd_find_client(item, NULL, 1);
|
||||||
struct window_pane *wp = item->state.tflag.wp;
|
struct window_pane *wp = item->target.wp;
|
||||||
struct session *s = item->state.tflag.s;
|
struct session *s = item->target.s;
|
||||||
struct winlink *wl = item->state.tflag.wl;
|
struct winlink *wl = item->target.wl;
|
||||||
char *cmd;
|
char *cmd;
|
||||||
int old_fd, pipe_fd[2], null_fd;
|
int old_fd, pipe_fd[2], null_fd;
|
||||||
struct format_tree *ft;
|
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);
|
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. */
|
/* Fire command on command queue. */
|
||||||
static enum cmd_retval
|
static enum cmd_retval
|
||||||
cmdq_fire_command(struct cmdq_item *item)
|
cmdq_fire_command(struct cmdq_item *item)
|
||||||
{
|
{
|
||||||
struct client *c = item->client;
|
struct client *c = item->client;
|
||||||
struct cmd *cmd = item->cmd;
|
struct cmd *cmd = item->cmd;
|
||||||
|
const struct cmd_entry *entry = cmd->entry;
|
||||||
enum cmd_retval retval;
|
enum cmd_retval retval;
|
||||||
const char *name;
|
|
||||||
struct cmd_find_state *fsp, fs;
|
struct cmd_find_state *fsp, fs;
|
||||||
int flags;
|
int flags;
|
||||||
|
|
||||||
@ -205,27 +225,27 @@ cmdq_fire_command(struct cmdq_item *item)
|
|||||||
|
|
||||||
if (item->client == NULL)
|
if (item->client == NULL)
|
||||||
item->client = cmd_find_client(item, NULL, 1);
|
item->client = cmd_find_client(item, NULL, 1);
|
||||||
|
retval = cmdq_find_flag(item, &item->source, &entry->source);
|
||||||
if (cmd_prepare_state(cmd, item) != 0) {
|
if (retval == CMD_RETURN_ERROR)
|
||||||
retval = CMD_RETURN_ERROR;
|
|
||||||
goto out;
|
goto out;
|
||||||
}
|
retval = cmdq_find_flag(item, &item->target, &entry->target);
|
||||||
|
|
||||||
retval = cmd->entry->exec(cmd, item);
|
|
||||||
if (retval == CMD_RETURN_ERROR)
|
if (retval == CMD_RETURN_ERROR)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
if (cmd->entry->flags & CMD_AFTERHOOK) {
|
retval = entry->exec(cmd, item);
|
||||||
name = cmd->entry->name;
|
if (retval == CMD_RETURN_ERROR)
|
||||||
if (cmd_find_valid_state(&item->state.tflag))
|
goto out;
|
||||||
fsp = &item->state.tflag;
|
|
||||||
|
if (entry->flags & CMD_AFTERHOOK) {
|
||||||
|
if (cmd_find_valid_state(&item->target))
|
||||||
|
fsp = &item->target;
|
||||||
else if (cmd_find_valid_state(&item->shared->current))
|
else if (cmd_find_valid_state(&item->shared->current))
|
||||||
fsp = &item->shared->current;
|
fsp = &item->shared->current;
|
||||||
else if (cmd_find_from_client(&fs, item->client) == 0)
|
else if (cmd_find_from_client(&fs, item->client) == 0)
|
||||||
fsp = &fs;
|
fsp = &fs;
|
||||||
else
|
else
|
||||||
goto out;
|
goto out;
|
||||||
hooks_insert(fsp->s->hooks, item, fsp, "after-%s", name);
|
hooks_insert(fsp->s->hooks, item, fsp, "after-%s", entry->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
out:
|
out:
|
||||||
|
@ -34,8 +34,6 @@ const struct cmd_entry cmd_refresh_client_entry = {
|
|||||||
.args = { "C:St:", 0, 0 },
|
.args = { "C:St:", 0, 0 },
|
||||||
.usage = "[-S] [-C size] " CMD_TARGET_CLIENT_USAGE,
|
.usage = "[-S] [-C size] " CMD_TARGET_CLIENT_USAGE,
|
||||||
|
|
||||||
.tflag = CMD_CLIENT,
|
|
||||||
|
|
||||||
.flags = CMD_AFTERHOOK,
|
.flags = CMD_AFTERHOOK,
|
||||||
.exec = cmd_refresh_client_exec
|
.exec = cmd_refresh_client_exec
|
||||||
};
|
};
|
||||||
@ -44,10 +42,13 @@ static enum cmd_retval
|
|||||||
cmd_refresh_client_exec(struct cmd *self, struct cmdq_item *item)
|
cmd_refresh_client_exec(struct cmd *self, struct cmdq_item *item)
|
||||||
{
|
{
|
||||||
struct args *args = self->args;
|
struct args *args = self->args;
|
||||||
struct client *c = item->state.c;
|
struct client *c;
|
||||||
const char *size;
|
const char *size;
|
||||||
u_int w, h;
|
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 (args_has(args, 'C')) {
|
||||||
if ((size = args_get(args, 'C')) == NULL) {
|
if ((size = args_get(args, 'C')) == NULL) {
|
||||||
cmdq_error(item, "missing size");
|
cmdq_error(item, "missing size");
|
||||||
|
@ -37,7 +37,7 @@ const struct cmd_entry cmd_rename_session_entry = {
|
|||||||
.args = { "t:", 1, 1 },
|
.args = { "t:", 1, 1 },
|
||||||
.usage = CMD_TARGET_SESSION_USAGE " new-name",
|
.usage = CMD_TARGET_SESSION_USAGE " new-name",
|
||||||
|
|
||||||
.tflag = CMD_SESSION,
|
.target = { 't', CMD_FIND_SESSION, 0 },
|
||||||
|
|
||||||
.flags = CMD_AFTERHOOK,
|
.flags = CMD_AFTERHOOK,
|
||||||
.exec = cmd_rename_session_exec
|
.exec = cmd_rename_session_exec
|
||||||
@ -47,7 +47,7 @@ static enum cmd_retval
|
|||||||
cmd_rename_session_exec(struct cmd *self, struct cmdq_item *item)
|
cmd_rename_session_exec(struct cmd *self, struct cmdq_item *item)
|
||||||
{
|
{
|
||||||
struct args *args = self->args;
|
struct args *args = self->args;
|
||||||
struct session *s = item->state.tflag.s;
|
struct session *s = item->target.s;
|
||||||
const char *newname;
|
const char *newname;
|
||||||
|
|
||||||
newname = args->argv[0];
|
newname = args->argv[0];
|
||||||
|
@ -36,7 +36,7 @@ const struct cmd_entry cmd_rename_window_entry = {
|
|||||||
.args = { "t:", 1, 1 },
|
.args = { "t:", 1, 1 },
|
||||||
.usage = CMD_TARGET_WINDOW_USAGE " new-name",
|
.usage = CMD_TARGET_WINDOW_USAGE " new-name",
|
||||||
|
|
||||||
.tflag = CMD_WINDOW,
|
.target = { 't', CMD_FIND_WINDOW, 0 },
|
||||||
|
|
||||||
.flags = CMD_AFTERHOOK,
|
.flags = CMD_AFTERHOOK,
|
||||||
.exec = cmd_rename_window_exec
|
.exec = cmd_rename_window_exec
|
||||||
@ -46,7 +46,7 @@ static enum cmd_retval
|
|||||||
cmd_rename_window_exec(struct cmd *self, struct cmdq_item *item)
|
cmd_rename_window_exec(struct cmd *self, struct cmdq_item *item)
|
||||||
{
|
{
|
||||||
struct args *args = self->args;
|
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]);
|
window_set_name(wl->window, args->argv[0]);
|
||||||
options_set_number(wl->window->options, "automatic-rename", 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 " "
|
.usage = "[-DLMRUZ] [-x width] [-y height] " CMD_TARGET_PANE_USAGE " "
|
||||||
"[adjustment]",
|
"[adjustment]",
|
||||||
|
|
||||||
.tflag = CMD_PANE,
|
.target = { 't', CMD_FIND_PANE, 0 },
|
||||||
|
|
||||||
.flags = CMD_AFTERHOOK,
|
.flags = CMD_AFTERHOOK,
|
||||||
.exec = cmd_resize_pane_exec
|
.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 args *args = self->args;
|
||||||
struct cmdq_shared *shared = item->shared;
|
struct cmdq_shared *shared = item->shared;
|
||||||
struct window_pane *wp = item->state.tflag.wp;
|
struct window_pane *wp = item->target.wp;
|
||||||
struct winlink *wl = item->state.tflag.wl;
|
struct winlink *wl = item->target.wl;
|
||||||
struct window *w = wl->window;
|
struct window *w = wl->window;
|
||||||
struct client *c = item->client;
|
struct client *c = item->client;
|
||||||
struct session *s = item->state.tflag.s;
|
struct session *s = item->target.s;
|
||||||
const char *errstr;
|
const char *errstr;
|
||||||
char *cause;
|
char *cause;
|
||||||
u_int adjust;
|
u_int adjust;
|
||||||
|
@ -37,7 +37,7 @@ const struct cmd_entry cmd_respawn_pane_entry = {
|
|||||||
.args = { "kt:", 0, -1 },
|
.args = { "kt:", 0, -1 },
|
||||||
.usage = "[-k] " CMD_TARGET_PANE_USAGE " [command]",
|
.usage = "[-k] " CMD_TARGET_PANE_USAGE " [command]",
|
||||||
|
|
||||||
.tflag = CMD_PANE,
|
.target = { 't', CMD_FIND_PANE, 0 },
|
||||||
|
|
||||||
.flags = 0,
|
.flags = 0,
|
||||||
.exec = cmd_respawn_pane_exec
|
.exec = cmd_respawn_pane_exec
|
||||||
@ -47,10 +47,10 @@ static enum cmd_retval
|
|||||||
cmd_respawn_pane_exec(struct cmd *self, struct cmdq_item *item)
|
cmd_respawn_pane_exec(struct cmd *self, struct cmdq_item *item)
|
||||||
{
|
{
|
||||||
struct args *args = self->args;
|
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 *w = wl->window;
|
||||||
struct window_pane *wp = item->state.tflag.wp;
|
struct window_pane *wp = item->target.wp;
|
||||||
struct session *s = item->state.tflag.s;
|
struct session *s = item->target.s;
|
||||||
struct environ *env;
|
struct environ *env;
|
||||||
const char *path;
|
const char *path;
|
||||||
char *cause;
|
char *cause;
|
||||||
|
@ -37,7 +37,7 @@ const struct cmd_entry cmd_respawn_window_entry = {
|
|||||||
.args = { "kt:", 0, -1 },
|
.args = { "kt:", 0, -1 },
|
||||||
.usage = "[-k] " CMD_TARGET_WINDOW_USAGE " [command]",
|
.usage = "[-k] " CMD_TARGET_WINDOW_USAGE " [command]",
|
||||||
|
|
||||||
.tflag = CMD_WINDOW,
|
.target = { 't', CMD_FIND_WINDOW, 0 },
|
||||||
|
|
||||||
.flags = 0,
|
.flags = 0,
|
||||||
.exec = cmd_respawn_window_exec
|
.exec = cmd_respawn_window_exec
|
||||||
@ -47,8 +47,8 @@ static enum cmd_retval
|
|||||||
cmd_respawn_window_exec(struct cmd *self, struct cmdq_item *item)
|
cmd_respawn_window_exec(struct cmd *self, struct cmdq_item *item)
|
||||||
{
|
{
|
||||||
struct args *args = self->args;
|
struct args *args = self->args;
|
||||||
struct session *s = item->state.tflag.s;
|
struct session *s = item->target.s;
|
||||||
struct winlink *wl = item->state.tflag.wl;
|
struct winlink *wl = item->target.wl;
|
||||||
struct window *w = wl->window;
|
struct window *w = wl->window;
|
||||||
struct window_pane *wp;
|
struct window_pane *wp;
|
||||||
struct environ *env;
|
struct environ *env;
|
||||||
|
@ -34,7 +34,7 @@ const struct cmd_entry cmd_rotate_window_entry = {
|
|||||||
.args = { "Dt:U", 0, 0 },
|
.args = { "Dt:U", 0, 0 },
|
||||||
.usage = "[-DU] " CMD_TARGET_WINDOW_USAGE,
|
.usage = "[-DU] " CMD_TARGET_WINDOW_USAGE,
|
||||||
|
|
||||||
.tflag = CMD_WINDOW,
|
.target = { 't', CMD_FIND_WINDOW, 0 },
|
||||||
|
|
||||||
.flags = 0,
|
.flags = 0,
|
||||||
.exec = cmd_rotate_window_exec
|
.exec = cmd_rotate_window_exec
|
||||||
@ -43,7 +43,7 @@ const struct cmd_entry cmd_rotate_window_entry = {
|
|||||||
static enum cmd_retval
|
static enum cmd_retval
|
||||||
cmd_rotate_window_exec(struct cmd *self, struct cmdq_item *item)
|
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 *w = wl->window;
|
||||||
struct window_pane *wp, *wp2;
|
struct window_pane *wp, *wp2;
|
||||||
struct layout_cell *lc;
|
struct layout_cell *lc;
|
||||||
|
@ -42,7 +42,7 @@ const struct cmd_entry cmd_run_shell_entry = {
|
|||||||
.args = { "bt:", 1, 1 },
|
.args = { "bt:", 1, 1 },
|
||||||
.usage = "[-b] " CMD_TARGET_PANE_USAGE " shell-command",
|
.usage = "[-b] " CMD_TARGET_PANE_USAGE " shell-command",
|
||||||
|
|
||||||
.tflag = CMD_PANE_CANFAIL,
|
.target = { 't', CMD_FIND_PANE, CMD_FIND_CANFAIL },
|
||||||
|
|
||||||
.flags = 0,
|
.flags = 0,
|
||||||
.exec = cmd_run_shell_exec
|
.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 args *args = self->args;
|
||||||
struct cmd_run_shell_data *cdata;
|
struct cmd_run_shell_data *cdata;
|
||||||
struct client *c = item->state.c;
|
struct client *c = cmd_find_client(item, NULL, 1);
|
||||||
struct session *s = item->state.tflag.s;
|
struct session *s = item->target.s;
|
||||||
struct winlink *wl = item->state.tflag.wl;
|
struct winlink *wl = item->target.wl;
|
||||||
struct window_pane *wp = item->state.tflag.wp;
|
struct window_pane *wp = item->target.wp;
|
||||||
const char *cwd;
|
const char *cwd;
|
||||||
|
|
||||||
if (item->client != NULL && item->client->session == NULL)
|
if (item->client != NULL && item->client->session == NULL)
|
||||||
|
@ -36,7 +36,7 @@ const struct cmd_entry cmd_select_layout_entry = {
|
|||||||
.args = { "nopt:", 0, 1 },
|
.args = { "nopt:", 0, 1 },
|
||||||
.usage = "[-nop] " CMD_TARGET_WINDOW_USAGE " [layout-name]",
|
.usage = "[-nop] " CMD_TARGET_WINDOW_USAGE " [layout-name]",
|
||||||
|
|
||||||
.tflag = CMD_WINDOW,
|
.target = { 't', CMD_FIND_WINDOW, 0 },
|
||||||
|
|
||||||
.flags = CMD_AFTERHOOK,
|
.flags = CMD_AFTERHOOK,
|
||||||
.exec = cmd_select_layout_exec
|
.exec = cmd_select_layout_exec
|
||||||
@ -49,7 +49,7 @@ const struct cmd_entry cmd_next_layout_entry = {
|
|||||||
.args = { "t:", 0, 0 },
|
.args = { "t:", 0, 0 },
|
||||||
.usage = CMD_TARGET_WINDOW_USAGE,
|
.usage = CMD_TARGET_WINDOW_USAGE,
|
||||||
|
|
||||||
.tflag = CMD_WINDOW,
|
.target = { 't', CMD_FIND_WINDOW, 0 },
|
||||||
|
|
||||||
.flags = CMD_AFTERHOOK,
|
.flags = CMD_AFTERHOOK,
|
||||||
.exec = cmd_select_layout_exec
|
.exec = cmd_select_layout_exec
|
||||||
@ -62,7 +62,7 @@ const struct cmd_entry cmd_previous_layout_entry = {
|
|||||||
.args = { "t:", 0, 0 },
|
.args = { "t:", 0, 0 },
|
||||||
.usage = CMD_TARGET_WINDOW_USAGE,
|
.usage = CMD_TARGET_WINDOW_USAGE,
|
||||||
|
|
||||||
.tflag = CMD_WINDOW,
|
.target = { 't', CMD_FIND_WINDOW, 0 },
|
||||||
|
|
||||||
.flags = CMD_AFTERHOOK,
|
.flags = CMD_AFTERHOOK,
|
||||||
.exec = cmd_select_layout_exec
|
.exec = cmd_select_layout_exec
|
||||||
@ -72,7 +72,7 @@ static enum cmd_retval
|
|||||||
cmd_select_layout_exec(struct cmd *self, struct cmdq_item *item)
|
cmd_select_layout_exec(struct cmd *self, struct cmdq_item *item)
|
||||||
{
|
{
|
||||||
struct args *args = self->args;
|
struct args *args = self->args;
|
||||||
struct winlink *wl = item->state.tflag.wl;
|
struct winlink *wl = item->target.wl;
|
||||||
struct window *w;
|
struct window *w;
|
||||||
const char *layoutname;
|
const char *layoutname;
|
||||||
char *oldlayout;
|
char *oldlayout;
|
||||||
|
@ -33,7 +33,7 @@ const struct cmd_entry cmd_select_pane_entry = {
|
|||||||
.args = { "DdegLlMmP:Rt:U", 0, 0 },
|
.args = { "DdegLlMmP:Rt:U", 0, 0 },
|
||||||
.usage = "[-DdegLlMmRU] [-P style] " CMD_TARGET_PANE_USAGE,
|
.usage = "[-DdegLlMmRU] [-P style] " CMD_TARGET_PANE_USAGE,
|
||||||
|
|
||||||
.tflag = CMD_PANE,
|
.target = { 't', CMD_FIND_PANE, 0 },
|
||||||
|
|
||||||
.flags = 0,
|
.flags = 0,
|
||||||
.exec = cmd_select_pane_exec
|
.exec = cmd_select_pane_exec
|
||||||
@ -46,7 +46,7 @@ const struct cmd_entry cmd_last_pane_entry = {
|
|||||||
.args = { "det:", 0, 0 },
|
.args = { "det:", 0, 0 },
|
||||||
.usage = "[-de] " CMD_TARGET_WINDOW_USAGE,
|
.usage = "[-de] " CMD_TARGET_WINDOW_USAGE,
|
||||||
|
|
||||||
.tflag = CMD_WINDOW,
|
.target = { 't', CMD_FIND_WINDOW, 0 },
|
||||||
|
|
||||||
.flags = 0,
|
.flags = 0,
|
||||||
.exec = cmd_select_pane_exec
|
.exec = cmd_select_pane_exec
|
||||||
@ -57,10 +57,10 @@ cmd_select_pane_exec(struct cmd *self, struct cmdq_item *item)
|
|||||||
{
|
{
|
||||||
struct args *args = self->args;
|
struct args *args = self->args;
|
||||||
struct cmd_find_state *current = &item->shared->current;
|
struct cmd_find_state *current = &item->shared->current;
|
||||||
struct winlink *wl = item->state.tflag.wl;
|
struct winlink *wl = item->target.wl;
|
||||||
struct window *w = wl->window;
|
struct window *w = wl->window;
|
||||||
struct session *s = item->state.tflag.s;
|
struct session *s = item->target.s;
|
||||||
struct window_pane *wp = item->state.tflag.wp, *lastwp, *markedwp;
|
struct window_pane *wp = item->target.wp, *lastwp, *markedwp;
|
||||||
const char *style;
|
const char *style;
|
||||||
|
|
||||||
if (self->entry == &cmd_last_pane_entry || args_has(args, 'l')) {
|
if (self->entry == &cmd_last_pane_entry || args_has(args, 'l')) {
|
||||||
|
@ -36,7 +36,7 @@ const struct cmd_entry cmd_select_window_entry = {
|
|||||||
.args = { "lnpTt:", 0, 0 },
|
.args = { "lnpTt:", 0, 0 },
|
||||||
.usage = "[-lnpT] " CMD_TARGET_WINDOW_USAGE,
|
.usage = "[-lnpT] " CMD_TARGET_WINDOW_USAGE,
|
||||||
|
|
||||||
.tflag = CMD_WINDOW,
|
.target = { 't', CMD_FIND_WINDOW, 0 },
|
||||||
|
|
||||||
.flags = 0,
|
.flags = 0,
|
||||||
.exec = cmd_select_window_exec
|
.exec = cmd_select_window_exec
|
||||||
@ -49,7 +49,7 @@ const struct cmd_entry cmd_next_window_entry = {
|
|||||||
.args = { "at:", 0, 0 },
|
.args = { "at:", 0, 0 },
|
||||||
.usage = "[-a] " CMD_TARGET_SESSION_USAGE,
|
.usage = "[-a] " CMD_TARGET_SESSION_USAGE,
|
||||||
|
|
||||||
.tflag = CMD_SESSION,
|
.target = { 't', CMD_FIND_SESSION, 0 },
|
||||||
|
|
||||||
.flags = 0,
|
.flags = 0,
|
||||||
.exec = cmd_select_window_exec
|
.exec = cmd_select_window_exec
|
||||||
@ -62,7 +62,7 @@ const struct cmd_entry cmd_previous_window_entry = {
|
|||||||
.args = { "at:", 0, 0 },
|
.args = { "at:", 0, 0 },
|
||||||
.usage = "[-a] " CMD_TARGET_SESSION_USAGE,
|
.usage = "[-a] " CMD_TARGET_SESSION_USAGE,
|
||||||
|
|
||||||
.tflag = CMD_SESSION,
|
.target = { 't', CMD_FIND_SESSION, 0 },
|
||||||
|
|
||||||
.flags = 0,
|
.flags = 0,
|
||||||
.exec = cmd_select_window_exec
|
.exec = cmd_select_window_exec
|
||||||
@ -75,7 +75,7 @@ const struct cmd_entry cmd_last_window_entry = {
|
|||||||
.args = { "t:", 0, 0 },
|
.args = { "t:", 0, 0 },
|
||||||
.usage = CMD_TARGET_SESSION_USAGE,
|
.usage = CMD_TARGET_SESSION_USAGE,
|
||||||
|
|
||||||
.tflag = CMD_SESSION,
|
.target = { 't', CMD_FIND_SESSION, 0 },
|
||||||
|
|
||||||
.flags = 0,
|
.flags = 0,
|
||||||
.exec = cmd_select_window_exec
|
.exec = cmd_select_window_exec
|
||||||
@ -85,8 +85,8 @@ static enum cmd_retval
|
|||||||
cmd_select_window_exec(struct cmd *self, struct cmdq_item *item)
|
cmd_select_window_exec(struct cmd *self, struct cmdq_item *item)
|
||||||
{
|
{
|
||||||
struct cmd_find_state *current = &item->shared->current;
|
struct cmd_find_state *current = &item->shared->current;
|
||||||
struct winlink *wl = item->state.tflag.wl;
|
struct winlink *wl = item->target.wl;
|
||||||
struct session *s = item->state.tflag.s;
|
struct session *s = item->target.s;
|
||||||
int next, previous, last, activity;
|
int next, previous, last, activity;
|
||||||
|
|
||||||
next = self->entry == &cmd_next_window_entry;
|
next = self->entry == &cmd_next_window_entry;
|
||||||
|
@ -36,7 +36,7 @@ const struct cmd_entry cmd_send_keys_entry = {
|
|||||||
.args = { "lXRMN:t:", 0, -1 },
|
.args = { "lXRMN:t:", 0, -1 },
|
||||||
.usage = "[-lXRM] [-N repeat-count] " CMD_TARGET_PANE_USAGE " key ...",
|
.usage = "[-lXRM] [-N repeat-count] " CMD_TARGET_PANE_USAGE " key ...",
|
||||||
|
|
||||||
.tflag = CMD_PANE,
|
.target = { 't', CMD_FIND_PANE, 0 },
|
||||||
|
|
||||||
.flags = CMD_AFTERHOOK,
|
.flags = CMD_AFTERHOOK,
|
||||||
.exec = cmd_send_keys_exec
|
.exec = cmd_send_keys_exec
|
||||||
@ -49,7 +49,7 @@ const struct cmd_entry cmd_send_prefix_entry = {
|
|||||||
.args = { "2t:", 0, 0 },
|
.args = { "2t:", 0, 0 },
|
||||||
.usage = "[-2] " CMD_TARGET_PANE_USAGE,
|
.usage = "[-2] " CMD_TARGET_PANE_USAGE,
|
||||||
|
|
||||||
.tflag = CMD_PANE,
|
.target = { 't', CMD_FIND_PANE, 0 },
|
||||||
|
|
||||||
.flags = CMD_AFTERHOOK,
|
.flags = CMD_AFTERHOOK,
|
||||||
.exec = cmd_send_keys_exec
|
.exec = cmd_send_keys_exec
|
||||||
@ -59,9 +59,9 @@ static enum cmd_retval
|
|||||||
cmd_send_keys_exec(struct cmd *self, struct cmdq_item *item)
|
cmd_send_keys_exec(struct cmd *self, struct cmdq_item *item)
|
||||||
{
|
{
|
||||||
struct args *args = self->args;
|
struct args *args = self->args;
|
||||||
struct client *c = item->state.c;
|
struct client *c = cmd_find_client(item, NULL, 1);
|
||||||
struct window_pane *wp = item->state.tflag.wp;
|
struct window_pane *wp = item->target.wp;
|
||||||
struct session *s = item->state.tflag.s;
|
struct session *s = item->target.s;
|
||||||
struct mouse_event *m = &item->shared->mouse;
|
struct mouse_event *m = &item->shared->mouse;
|
||||||
struct utf8_data *ud, *uc;
|
struct utf8_data *ud, *uc;
|
||||||
wchar_t wc;
|
wchar_t wc;
|
||||||
|
@ -37,7 +37,7 @@ const struct cmd_entry cmd_set_environment_entry = {
|
|||||||
.args = { "grt:u", 1, 2 },
|
.args = { "grt:u", 1, 2 },
|
||||||
.usage = "[-gru] " CMD_TARGET_SESSION_USAGE " name [value]",
|
.usage = "[-gru] " CMD_TARGET_SESSION_USAGE " name [value]",
|
||||||
|
|
||||||
.tflag = CMD_SESSION_CANFAIL,
|
.target = { 't', CMD_FIND_SESSION, CMD_FIND_CANFAIL },
|
||||||
|
|
||||||
.flags = CMD_AFTERHOOK,
|
.flags = CMD_AFTERHOOK,
|
||||||
.exec = cmd_set_environment_exec
|
.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'))
|
if (args_has(self->args, 'g'))
|
||||||
env = global_environ;
|
env = global_environ;
|
||||||
else {
|
else {
|
||||||
if (item->state.tflag.s == NULL) {
|
if (item->target.s == NULL) {
|
||||||
target = args_get(args, 't');
|
target = args_get(args, 't');
|
||||||
if (target != NULL)
|
if (target != NULL)
|
||||||
cmdq_error(item, "no such session: %s", target);
|
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");
|
cmdq_error(item, "no current session");
|
||||||
return (CMD_RETURN_ERROR);
|
return (CMD_RETURN_ERROR);
|
||||||
}
|
}
|
||||||
env = item->state.tflag.s->environ;
|
env = item->target.s->environ;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args_has(self->args, 'u')) {
|
if (args_has(self->args, 'u')) {
|
||||||
|
@ -36,7 +36,7 @@ const struct cmd_entry cmd_set_hook_entry = {
|
|||||||
.args = { "gt:u", 1, 2 },
|
.args = { "gt:u", 1, 2 },
|
||||||
.usage = "[-gu] " CMD_TARGET_SESSION_USAGE " hook-name [command]",
|
.usage = "[-gu] " CMD_TARGET_SESSION_USAGE " hook-name [command]",
|
||||||
|
|
||||||
.tflag = CMD_SESSION_CANFAIL,
|
.target = { 't', CMD_FIND_SESSION, CMD_FIND_CANFAIL },
|
||||||
|
|
||||||
.flags = CMD_AFTERHOOK,
|
.flags = CMD_AFTERHOOK,
|
||||||
.exec = cmd_set_hook_exec
|
.exec = cmd_set_hook_exec
|
||||||
@ -49,7 +49,7 @@ const struct cmd_entry cmd_show_hooks_entry = {
|
|||||||
.args = { "gt:", 0, 1 },
|
.args = { "gt:", 0, 1 },
|
||||||
.usage = "[-g] " CMD_TARGET_SESSION_USAGE,
|
.usage = "[-g] " CMD_TARGET_SESSION_USAGE,
|
||||||
|
|
||||||
.tflag = CMD_SESSION,
|
.target = { 't', CMD_FIND_SESSION, 0 },
|
||||||
|
|
||||||
.flags = CMD_AFTERHOOK,
|
.flags = CMD_AFTERHOOK,
|
||||||
.exec = cmd_set_hook_exec
|
.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'))
|
if (args_has(args, 'g'))
|
||||||
hooks = global_hooks;
|
hooks = global_hooks;
|
||||||
else {
|
else {
|
||||||
if (item->state.tflag.s == NULL) {
|
if (item->target.s == NULL) {
|
||||||
target = args_get(args, 't');
|
target = args_get(args, 't');
|
||||||
if (target != NULL)
|
if (target != NULL)
|
||||||
cmdq_error(item, "no such session: %s", target);
|
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");
|
cmdq_error(item, "no current session");
|
||||||
return (CMD_RETURN_ERROR);
|
return (CMD_RETURN_ERROR);
|
||||||
}
|
}
|
||||||
hooks = item->state.tflag.s->hooks;
|
hooks = item->target.s->hooks;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (self->entry == &cmd_show_hooks_entry) {
|
if (self->entry == &cmd_show_hooks_entry) {
|
||||||
|
@ -45,7 +45,7 @@ const struct cmd_entry cmd_set_option_entry = {
|
|||||||
.args = { "agoqst:uw", 1, 2 },
|
.args = { "agoqst:uw", 1, 2 },
|
||||||
.usage = "[-agosquw] [-t target-window] option [value]",
|
.usage = "[-agosquw] [-t target-window] option [value]",
|
||||||
|
|
||||||
.tflag = CMD_WINDOW_CANFAIL,
|
.target = { 't', CMD_FIND_WINDOW, CMD_FIND_CANFAIL },
|
||||||
|
|
||||||
.flags = CMD_AFTERHOOK,
|
.flags = CMD_AFTERHOOK,
|
||||||
.exec = cmd_set_option_exec
|
.exec = cmd_set_option_exec
|
||||||
@ -58,7 +58,7 @@ const struct cmd_entry cmd_set_window_option_entry = {
|
|||||||
.args = { "agoqt:u", 1, 2 },
|
.args = { "agoqt:u", 1, 2 },
|
||||||
.usage = "[-agoqu] " CMD_TARGET_WINDOW_USAGE " option [value]",
|
.usage = "[-agoqu] " CMD_TARGET_WINDOW_USAGE " option [value]",
|
||||||
|
|
||||||
.tflag = CMD_WINDOW_CANFAIL,
|
.target = { 't', CMD_FIND_WINDOW, CMD_FIND_CANFAIL },
|
||||||
|
|
||||||
.flags = CMD_AFTERHOOK,
|
.flags = CMD_AFTERHOOK,
|
||||||
.exec = cmd_set_option_exec
|
.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;
|
struct args *args = self->args;
|
||||||
int append = args_has(args, 'a');
|
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 session *s = fs->s;
|
||||||
struct winlink *wl = fs->wl;
|
struct winlink *wl = fs->wl;
|
||||||
struct window *w;
|
struct window *w;
|
||||||
|
@ -41,7 +41,7 @@ const struct cmd_entry cmd_show_environment_entry = {
|
|||||||
.args = { "gst:", 0, 1 },
|
.args = { "gst:", 0, 1 },
|
||||||
.usage = "[-gs] " CMD_TARGET_SESSION_USAGE " [name]",
|
.usage = "[-gs] " CMD_TARGET_SESSION_USAGE " [name]",
|
||||||
|
|
||||||
.tflag = CMD_SESSION_CANFAIL,
|
.target = { 't', CMD_FIND_SESSION, CMD_FIND_CANFAIL },
|
||||||
|
|
||||||
.flags = CMD_AFTERHOOK,
|
.flags = CMD_AFTERHOOK,
|
||||||
.exec = cmd_show_environment_exec
|
.exec = cmd_show_environment_exec
|
||||||
@ -97,7 +97,7 @@ cmd_show_environment_exec(struct cmd *self, struct cmdq_item *item)
|
|||||||
const char *target;
|
const char *target;
|
||||||
|
|
||||||
if ((target = args_get(args, 't')) != NULL) {
|
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);
|
cmdq_error(item, "no such session: %s", target);
|
||||||
return (CMD_RETURN_ERROR);
|
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'))
|
if (args_has(self->args, 'g'))
|
||||||
env = global_environ;
|
env = global_environ;
|
||||||
else {
|
else {
|
||||||
if (item->state.tflag.s == NULL) {
|
if (item->target.s == NULL) {
|
||||||
target = args_get(args, 't');
|
target = args_get(args, 't');
|
||||||
if (target != NULL)
|
if (target != NULL)
|
||||||
cmdq_error(item, "no such session: %s", target);
|
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");
|
cmdq_error(item, "no current session");
|
||||||
return (CMD_RETURN_ERROR);
|
return (CMD_RETURN_ERROR);
|
||||||
}
|
}
|
||||||
env = item->state.tflag.s->environ;
|
env = item->target.s->environ;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args->argc != 0) {
|
if (args->argc != 0) {
|
||||||
|
@ -39,8 +39,6 @@ const struct cmd_entry cmd_show_messages_entry = {
|
|||||||
.args = { "JTt:", 0, 0 },
|
.args = { "JTt:", 0, 0 },
|
||||||
.usage = "[-JT] " CMD_TARGET_CLIENT_USAGE,
|
.usage = "[-JT] " CMD_TARGET_CLIENT_USAGE,
|
||||||
|
|
||||||
.tflag = CMD_CLIENT,
|
|
||||||
|
|
||||||
.flags = CMD_AFTERHOOK,
|
.flags = CMD_AFTERHOOK,
|
||||||
.exec = cmd_show_messages_exec
|
.exec = cmd_show_messages_exec
|
||||||
};
|
};
|
||||||
@ -92,11 +90,14 @@ static enum cmd_retval
|
|||||||
cmd_show_messages_exec(struct cmd *self, struct cmdq_item *item)
|
cmd_show_messages_exec(struct cmd *self, struct cmdq_item *item)
|
||||||
{
|
{
|
||||||
struct args *args = self->args;
|
struct args *args = self->args;
|
||||||
struct client *c = item->state.c;
|
struct client *c;
|
||||||
struct message_entry *msg;
|
struct message_entry *msg;
|
||||||
char *tim;
|
char *tim;
|
||||||
int done, blank;
|
int done, blank;
|
||||||
|
|
||||||
|
if ((c = cmd_find_client(item, args_get(args, 't'), 0)) == NULL)
|
||||||
|
return (CMD_RETURN_ERROR);
|
||||||
|
|
||||||
done = blank = 0;
|
done = blank = 0;
|
||||||
if (args_has(args, 'T')) {
|
if (args_has(args, 'T')) {
|
||||||
blank = cmd_show_messages_terminals(item, blank);
|
blank = cmd_show_messages_terminals(item, blank);
|
||||||
|
@ -42,7 +42,7 @@ const struct cmd_entry cmd_show_options_entry = {
|
|||||||
.args = { "gqst:vw", 0, 1 },
|
.args = { "gqst:vw", 0, 1 },
|
||||||
.usage = "[-gqsvw] [-t target-session|target-window] [option]",
|
.usage = "[-gqsvw] [-t target-session|target-window] [option]",
|
||||||
|
|
||||||
.tflag = CMD_WINDOW_CANFAIL,
|
.target = { 't', CMD_FIND_WINDOW, CMD_FIND_CANFAIL },
|
||||||
|
|
||||||
.flags = CMD_AFTERHOOK,
|
.flags = CMD_AFTERHOOK,
|
||||||
.exec = cmd_show_options_exec
|
.exec = cmd_show_options_exec
|
||||||
@ -55,7 +55,7 @@ const struct cmd_entry cmd_show_window_options_entry = {
|
|||||||
.args = { "gvt:", 0, 1 },
|
.args = { "gvt:", 0, 1 },
|
||||||
.usage = "[-gv] " CMD_TARGET_WINDOW_USAGE " [option]",
|
.usage = "[-gv] " CMD_TARGET_WINDOW_USAGE " [option]",
|
||||||
|
|
||||||
.tflag = CMD_WINDOW_CANFAIL,
|
.target = { 't', CMD_FIND_WINDOW, CMD_FIND_CANFAIL },
|
||||||
|
|
||||||
.flags = CMD_AFTERHOOK,
|
.flags = CMD_AFTERHOOK,
|
||||||
.exec = cmd_show_options_exec
|
.exec = cmd_show_options_exec
|
||||||
@ -65,7 +65,7 @@ static enum cmd_retval
|
|||||||
cmd_show_options_exec(struct cmd *self, struct cmdq_item *item)
|
cmd_show_options_exec(struct cmd *self, struct cmdq_item *item)
|
||||||
{
|
{
|
||||||
struct args *args = self->args;
|
struct args *args = self->args;
|
||||||
struct cmd_find_state *fs = &item->state.tflag;
|
struct cmd_find_state *fs = &item->target;
|
||||||
struct options *oo;
|
struct options *oo;
|
||||||
enum options_table_scope scope;
|
enum options_table_scope scope;
|
||||||
char *cause;
|
char *cause;
|
||||||
|
@ -44,7 +44,7 @@ const struct cmd_entry cmd_split_window_entry = {
|
|||||||
.usage = "[-bdfhvP] [-c start-directory] [-F format] "
|
.usage = "[-bdfhvP] [-c start-directory] [-F format] "
|
||||||
"[-p percentage|-l size] " CMD_TARGET_PANE_USAGE " [command]",
|
"[-p percentage|-l size] " CMD_TARGET_PANE_USAGE " [command]",
|
||||||
|
|
||||||
.tflag = CMD_PANE,
|
.target = { 't', CMD_FIND_PANE, 0 },
|
||||||
|
|
||||||
.flags = 0,
|
.flags = 0,
|
||||||
.exec = cmd_split_window_exec
|
.exec = cmd_split_window_exec
|
||||||
@ -55,11 +55,11 @@ cmd_split_window_exec(struct cmd *self, struct cmdq_item *item)
|
|||||||
{
|
{
|
||||||
struct cmd_find_state *current = &item->shared->current;
|
struct cmd_find_state *current = &item->shared->current;
|
||||||
struct args *args = self->args;
|
struct args *args = self->args;
|
||||||
struct client *c = item->state.c;
|
struct client *c = cmd_find_client(item, NULL, 1);
|
||||||
struct session *s = item->state.tflag.s;
|
struct session *s = item->target.s;
|
||||||
struct winlink *wl = item->state.tflag.wl;
|
struct winlink *wl = item->target.wl;
|
||||||
struct window *w = wl->window;
|
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;
|
struct environ *env;
|
||||||
const char *cmd, *path, *shell, *template, *cwd, *to_free;
|
const char *cmd, *path, *shell, *template, *cwd, *to_free;
|
||||||
char **argv, *cause, *new_cause, *cp;
|
char **argv, *cause, *new_cause, *cp;
|
||||||
|
@ -35,8 +35,8 @@ const struct cmd_entry cmd_swap_pane_entry = {
|
|||||||
.args = { "dDs:t:U", 0, 0 },
|
.args = { "dDs:t:U", 0, 0 },
|
||||||
.usage = "[-dDU] " CMD_SRCDST_PANE_USAGE,
|
.usage = "[-dDU] " CMD_SRCDST_PANE_USAGE,
|
||||||
|
|
||||||
.sflag = CMD_PANE_MARKED,
|
.source = { 's', CMD_FIND_PANE, CMD_FIND_DEFAULT_MARKED },
|
||||||
.tflag = CMD_PANE,
|
.target = { 't', CMD_FIND_PANE, 0 },
|
||||||
|
|
||||||
.flags = 0,
|
.flags = 0,
|
||||||
.exec = cmd_swap_pane_exec
|
.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;
|
struct layout_cell *src_lc, *dst_lc;
|
||||||
u_int sx, sy, xoff, yoff;
|
u_int sx, sy, xoff, yoff;
|
||||||
|
|
||||||
dst_w = item->state.tflag.wl->window;
|
dst_w = item->target.wl->window;
|
||||||
dst_wp = item->state.tflag.wp;
|
dst_wp = item->target.wp;
|
||||||
src_w = item->state.sflag.wl->window;
|
src_w = item->source.wl->window;
|
||||||
src_wp = item->state.sflag.wp;
|
src_wp = item->source.wp;
|
||||||
server_unzoom_window(dst_w);
|
server_unzoom_window(dst_w);
|
||||||
|
|
||||||
if (args_has(self->args, 'D')) {
|
if (args_has(self->args, 'D')) {
|
||||||
|
@ -35,8 +35,8 @@ const struct cmd_entry cmd_swap_window_entry = {
|
|||||||
.args = { "ds:t:", 0, 0 },
|
.args = { "ds:t:", 0, 0 },
|
||||||
.usage = "[-d] " CMD_SRCDST_WINDOW_USAGE,
|
.usage = "[-d] " CMD_SRCDST_WINDOW_USAGE,
|
||||||
|
|
||||||
.sflag = CMD_WINDOW_MARKED,
|
.source = { 's', CMD_FIND_WINDOW, CMD_FIND_DEFAULT_MARKED },
|
||||||
.tflag = CMD_WINDOW,
|
.target = { 't', CMD_FIND_WINDOW, 0 },
|
||||||
|
|
||||||
.flags = 0,
|
.flags = 0,
|
||||||
.exec = cmd_swap_window_exec
|
.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 winlink *wl_src, *wl_dst;
|
||||||
struct window *w_src, *w_dst;
|
struct window *w_src, *w_dst;
|
||||||
|
|
||||||
wl_src = item->state.sflag.wl;
|
wl_src = item->source.wl;
|
||||||
src = item->state.sflag.s;
|
src = item->source.s;
|
||||||
sg_src = session_group_contains(src);
|
sg_src = session_group_contains(src);
|
||||||
|
|
||||||
wl_dst = item->state.tflag.wl;
|
wl_dst = item->target.wl;
|
||||||
dst = item->state.tflag.s;
|
dst = item->target.s;
|
||||||
sg_dst = session_group_contains(dst);
|
sg_dst = session_group_contains(dst);
|
||||||
|
|
||||||
if (src != dst && sg_src != NULL && sg_dst != NULL &&
|
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] "
|
.usage = "[-Elnpr] [-c target-client] [-t target-session] "
|
||||||
"[-T key-table]",
|
"[-T key-table]",
|
||||||
|
|
||||||
.cflag = CMD_CLIENT,
|
/* -t is special */
|
||||||
.tflag = CMD_SESSION_WITHPANE,
|
|
||||||
|
|
||||||
.flags = CMD_READONLY,
|
.flags = CMD_READONLY,
|
||||||
.exec = cmd_switch_client_exec
|
.exec = cmd_switch_client_exec
|
||||||
@ -49,13 +48,32 @@ static enum cmd_retval
|
|||||||
cmd_switch_client_exec(struct cmd *self, struct cmdq_item *item)
|
cmd_switch_client_exec(struct cmd *self, struct cmdq_item *item)
|
||||||
{
|
{
|
||||||
struct args *args = self->args;
|
struct args *args = self->args;
|
||||||
struct cmd_state *state = &item->state;
|
const char *tflag = args_get(args, 't');
|
||||||
struct client *c = state->c;
|
enum cmd_find_type type;
|
||||||
struct session *s = item->state.tflag.s;
|
int flags;
|
||||||
|
struct client *c;
|
||||||
|
struct session *s;
|
||||||
|
struct winlink *wl;
|
||||||
struct window_pane *wp;
|
struct window_pane *wp;
|
||||||
const char *tablename;
|
const char *tablename;
|
||||||
struct key_table *table;
|
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'))
|
if (args_has(args, 'r'))
|
||||||
c->flags ^= CLIENT_READONLY;
|
c->flags ^= CLIENT_READONLY;
|
||||||
|
|
||||||
@ -94,11 +112,10 @@ cmd_switch_client_exec(struct cmd *self, struct cmdq_item *item)
|
|||||||
} else {
|
} else {
|
||||||
if (item->client == NULL)
|
if (item->client == NULL)
|
||||||
return (CMD_RETURN_NORMAL);
|
return (CMD_RETURN_NORMAL);
|
||||||
if (state->tflag.wl != NULL) {
|
if (wl != NULL) {
|
||||||
wp = state->tflag.wp;
|
|
||||||
if (wp != NULL)
|
if (wp != NULL)
|
||||||
window_set_active_pane(wp->window, wp);
|
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);
|
cmd_find_from_session(&item->shared->current, s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
174
cmd.c
174
cmd.c
@ -448,180 +448,6 @@ usage:
|
|||||||
return (NULL);
|
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 *
|
char *
|
||||||
cmd_print(struct cmd *cmd)
|
cmd_print(struct cmd *cmd)
|
||||||
{
|
{
|
||||||
|
52
tmux.h
52
tmux.h
@ -1162,13 +1162,7 @@ struct cmd_find_state {
|
|||||||
#define CMD_FIND_DEFAULT_MARKED 0x8
|
#define CMD_FIND_DEFAULT_MARKED 0x8
|
||||||
#define CMD_FIND_EXACT_SESSION 0x10
|
#define CMD_FIND_EXACT_SESSION 0x10
|
||||||
#define CMD_FIND_EXACT_WINDOW 0x20
|
#define CMD_FIND_EXACT_WINDOW 0x20
|
||||||
|
#define CMD_FIND_CANFAIL 0x40
|
||||||
/* Context for command being executed. */
|
|
||||||
struct cmd_state {
|
|
||||||
struct client *c;
|
|
||||||
struct cmd_find_state tflag;
|
|
||||||
struct cmd_find_state sflag;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Command and list of commands. */
|
/* Command and list of commands. */
|
||||||
struct cmd {
|
struct cmd {
|
||||||
@ -1237,40 +1231,24 @@ struct cmdq_item {
|
|||||||
#define CMDQ_NOHOOKS 0x4
|
#define CMDQ_NOHOOKS 0x4
|
||||||
|
|
||||||
struct cmdq_shared *shared;
|
struct cmdq_shared *shared;
|
||||||
|
struct cmd_find_state source;
|
||||||
|
struct cmd_find_state target;
|
||||||
|
|
||||||
struct cmd_list *cmdlist;
|
struct cmd_list *cmdlist;
|
||||||
struct cmd *cmd;
|
struct cmd *cmd;
|
||||||
|
|
||||||
cmdq_cb cb;
|
cmdq_cb cb;
|
||||||
void *data;
|
void *data;
|
||||||
|
|
||||||
struct cmd_state state;
|
|
||||||
|
|
||||||
TAILQ_ENTRY(cmdq_item) entry;
|
TAILQ_ENTRY(cmdq_item) entry;
|
||||||
};
|
};
|
||||||
TAILQ_HEAD(cmdq_list, cmdq_item);
|
TAILQ_HEAD(cmdq_list, cmdq_item);
|
||||||
|
|
||||||
/* Command -c, -t or -s flags. */
|
/* Command definition flag. */
|
||||||
enum cmd_entry_flag {
|
struct cmd_entry_flag {
|
||||||
CMD_NONE,
|
char flag;
|
||||||
|
enum cmd_find_type type;
|
||||||
CMD_CLIENT,
|
int flags;
|
||||||
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. */
|
/* Command definition. */
|
||||||
@ -1285,16 +1263,15 @@ struct cmd_entry {
|
|||||||
} args;
|
} args;
|
||||||
const char *usage;
|
const char *usage;
|
||||||
|
|
||||||
enum cmd_entry_flag tflag;
|
struct cmd_entry_flag source;
|
||||||
enum cmd_entry_flag sflag;
|
struct cmd_entry_flag target;
|
||||||
enum cmd_entry_flag cflag;
|
|
||||||
|
|
||||||
#define CMD_STARTSERVER 0x1
|
#define CMD_STARTSERVER 0x1
|
||||||
#define CMD_READONLY 0x2
|
#define CMD_READONLY 0x2
|
||||||
#define CMD_AFTERHOOK 0x4
|
#define CMD_AFTERHOOK 0x4
|
||||||
int flags;
|
int flags;
|
||||||
|
|
||||||
enum cmd_retval (*exec)(struct cmd *, struct cmdq_item *);
|
enum cmd_retval (*exec)(struct cmd *, struct cmdq_item *);
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Client connection. */
|
/* Client connection. */
|
||||||
@ -1761,7 +1738,6 @@ char **cmd_copy_argv(int, char **);
|
|||||||
void cmd_free_argv(int, char **);
|
void cmd_free_argv(int, char **);
|
||||||
char *cmd_stringify_argv(int, char **);
|
char *cmd_stringify_argv(int, char **);
|
||||||
struct cmd *cmd_parse(int, char **, const char *, u_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 *);
|
char *cmd_print(struct cmd *);
|
||||||
int cmd_mouse_at(struct window_pane *, struct mouse_event *,
|
int cmd_mouse_at(struct window_pane *, struct mouse_event *,
|
||||||
u_int *, u_int *, int);
|
u_int *, u_int *, int);
|
||||||
@ -1772,8 +1748,8 @@ char *cmd_template_replace(const char *, const char *, int);
|
|||||||
extern const struct cmd_entry *cmd_table[];
|
extern const struct cmd_entry *cmd_table[];
|
||||||
|
|
||||||
/* cmd-attach-session.c */
|
/* cmd-attach-session.c */
|
||||||
enum cmd_retval cmd_attach_session(struct cmdq_item *, int, int, const char *,
|
enum cmd_retval cmd_attach_session(struct cmdq_item *, const char *, int, int,
|
||||||
int);
|
const char *, int);
|
||||||
|
|
||||||
/* cmd-list.c */
|
/* cmd-list.c */
|
||||||
struct cmd_list *cmd_list_parse(int, char **, const char *, u_int, char **);
|
struct cmd_list *cmd_list_parse(int, char **, const char *, u_int, char **);
|
||||||
|
Loading…
Reference in New Issue
Block a user