Responsible for displaying list entries in choice mode. --- trunk/tmux.h | 3 +++ trunk/window-choose.c | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+)
diff --git a/trunk/tmux.h b/trunk/tmux.h index 49f053f..0dedd14 100644 --- a/trunk/tmux.h +++ b/trunk/tmux.h @@ -2152,6 +2152,9 @@ struct window_choose_data *window_choose_add_window(struct window_pane *, struct window_choose_data *window_choose_add_session(struct window_pane *, struct cmd_ctx *, struct session *, const char *, char *, u_int); +struct window_choose_data *window_choose_add_item(struct window_pane *, + struct cmd_ctx *, struct winlink *, const char *, + char *, u_int); /* names.c */ void queue_window_name(struct window *); diff --git a/trunk/window-choose.c b/trunk/window-choose.c index f385763..9b66f07 100644 --- a/trunk/window-choose.c +++ b/trunk/window-choose.c @@ -561,3 +561,36 @@ window_choose_add_window(struct window_pane *wp, struct cmd_ctx *ctx, return (wcd); } + +struct window_choose_data * +window_choose_add_item(struct window_pane *wp, struct cmd_ctx *ctx, + struct winlink *wl, const char *template, char *action, u_int idx) +{ + struct window_choose_data *wcd; + char *action_data; + + wcd = window_choose_data_create(ctx); + wcd->idx = wl->idx; + wcd->ft_template = xstrdup(template); + format_add(wcd->ft, "line", "%u", idx); + format_session(wcd->ft, wcd->session); + format_winlink(wcd->ft, wcd->session, wl); + format_window_pane(wcd->ft, wl->window->active); + + wcd->client->references++; + wcd->session->references++; + + window_choose_add(wp, wcd); + + /* + * Interpolate action_data here, since the data we pass back is the + * expanded template itself. + */ + xasprintf(&action_data, "%s", + format_expand(wcd->ft, wcd->ft_template)); + wcd->command = cmd_template_replace(action, action_data, 1); + free(action_data); + + return (wcd); + +} -- 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