Switch the callback of this command to use the centralised window_choose_ctx function. --- trunk/cmd-choose-window.c | 44 ++++++-------------------------------------- 1 file changed, 6 insertions(+), 38 deletions(-)
diff --git a/trunk/cmd-choose-window.c b/trunk/cmd-choose-window.c index 78fdaca..8ac0f0c 100644 --- a/trunk/cmd-choose-window.c +++ b/trunk/cmd-choose-window.c @@ -41,17 +41,11 @@ const struct cmd_entry cmd_choose_window_entry = { cmd_choose_window_exec }; -struct cmd_choose_window_data { - struct client *client; - struct session *session; - char *template; -}; - int cmd_choose_window_exec(struct cmd *self, struct cmd_ctx *ctx) { struct args *args = self->args; - struct cmd_choose_window_data *cdata; + struct window_choose_data *cdata; struct session *s; struct winlink *wl, *wm; struct format_tree *ft; @@ -112,11 +106,8 @@ cmd_choose_window_exec(struct cmd *self, struct cmd_ctx *ctx) void cmd_choose_window_callback(void *data, int idx) { - struct cmd_choose_window_data *cdata = data; + struct window_choose_data *cdata = data; struct session *s = cdata->session; - struct cmd_list *cmdlist; - struct cmd_ctx ctx; - char *target, *template, *cause; if (idx == -1) return; @@ -125,41 +116,18 @@ cmd_choose_window_callback(void *data, int idx) if (cdata->client->flags & CLIENT_DEAD) return; - xasprintf(&target, "%s:%d", s->name, idx); - template = cmd_template_replace(cdata->template, target, 1); - xfree(target); - - if (cmd_string_parse(template, &cmdlist, &cause) != 0) { - if (cause != NULL) { - *cause = toupper((u_char) *cause); - status_message_set(cdata->client, "%s", cause); - xfree(cause); - } - xfree(template); - return; - } - xfree(template); - - ctx.msgdata = NULL; - ctx.curclient = cdata->client; - - ctx.error = key_bindings_error; - ctx.print = key_bindings_print; - ctx.info = key_bindings_info; - - ctx.cmdclient = NULL; - - cmd_list_exec(cmdlist, &ctx); - cmd_list_free(cmdlist); + xasprintf(&cdata->raw_format, "%s:%d", s->name, idx); + window_choose_ctx(cdata); } void cmd_choose_window_free(void *data) { - struct cmd_choose_window_data *cdata = data; + struct window_choose_data *cdata = data; cdata->session->references--; cdata->client->references--; xfree(cdata->template); + xfree(cdata->raw_format); xfree(cdata); } -- 1.7.10 ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ tmux-users mailing list tmux-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/tmux-users