=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/Attic/window-choose.c,v retrieving revision 1.25 retrieving revision 1.26 diff -c -r1.25 -r1.26 *** src/usr.bin/tmux/Attic/window-choose.c 2012/08/27 21:29:23 1.25 --- src/usr.bin/tmux/Attic/window-choose.c 2012/09/03 09:57:57 1.26 *************** *** 1,4 **** ! /* $OpenBSD: window-choose.c,v 1.25 2012/08/27 21:29:23 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott --- 1,4 ---- ! /* $OpenBSD: window-choose.c,v 1.26 2012/09/03 09:57:57 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott *************** *** 634,639 **** --- 634,671 ---- window_choose_add(wp, wcd); 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); + } struct window_choose_data *