version 1.17, 2010/12/30 21:35:17 |
version 1.18, 2011/01/04 00:42:46 |
|
|
|
|
const struct cmd_entry cmd_choose_window_entry = { |
const struct cmd_entry cmd_choose_window_entry = { |
"choose-window", NULL, |
"choose-window", NULL, |
|
"t:", 0, 1, |
CMD_TARGET_WINDOW_USAGE " [template]", |
CMD_TARGET_WINDOW_USAGE " [template]", |
CMD_ARG01, "", |
0, |
cmd_target_init, |
NULL, |
cmd_target_parse, |
NULL, |
cmd_choose_window_exec, |
cmd_choose_window_exec |
cmd_target_free, |
|
cmd_target_print |
|
}; |
}; |
|
|
struct cmd_choose_window_data { |
struct cmd_choose_window_data { |
|
|
int |
int |
cmd_choose_window_exec(struct cmd *self, struct cmd_ctx *ctx) |
cmd_choose_window_exec(struct cmd *self, struct cmd_ctx *ctx) |
{ |
{ |
struct cmd_target_data *data = self->data; |
struct args *args = self->args; |
struct cmd_choose_window_data *cdata; |
struct cmd_choose_window_data *cdata; |
struct session *s; |
struct session *s; |
struct winlink *wl, *wm; |
struct winlink *wl, *wm; |
|
|
} |
} |
s = ctx->curclient->session; |
s = ctx->curclient->session; |
|
|
if ((wl = cmd_find_window(ctx, data->target, NULL)) == NULL) |
if ((wl = cmd_find_window(ctx, args_get(args, 't'), NULL)) == NULL) |
return (-1); |
return (-1); |
|
|
if (window_pane_set_mode(wl->window->active, &window_choose_mode) != 0) |
if (window_pane_set_mode(wl->window->active, &window_choose_mode) != 0) |
|
|
} |
} |
|
|
cdata = xmalloc(sizeof *cdata); |
cdata = xmalloc(sizeof *cdata); |
if (data->arg != NULL) |
if (args->argc != 0) |
cdata->template = xstrdup(data->arg); |
cdata->template = xstrdup(args->argv[0]); |
else |
else |
cdata->template = xstrdup("select-window -t '%%'"); |
cdata->template = xstrdup("select-window -t '%%'"); |
cdata->session = s; |
cdata->session = s; |