Hi

The plan is to eventually remove choose-list as part of some other work
on choose-*, so I don't think I'll use this sorry.


On Wed, Dec 04, 2013 at 02:04:12PM +0800, Xiaochen Wang wrote:
> Add [-d delim] option to choose-list command. 
> Then we can use 'delim' instead of comma to seperate list items.
> 
> Tmux cannot pass list item containing comma (e.g. "ss -tan  | awk '{print 
> \$1, \$4}' " ) to choose list originally.
> 
> >From 34c76e1689b9bb6be3862ef34a8c9778b009b8a6 Mon Sep 17 00:00:00 2001
> From: Xiaochen Wang <wangxiaoch...@gmail.com>
> Date: Wed, 4 Dec 2013 13:47:32 +0800
> Subject: [PATCH] choose-list: add -d option for items delimiter
> 
> ---
>  cmd-choose-list.c | 11 +++++++----
>  tmux.1            |  4 ++++
>  2 files changed, 11 insertions(+), 4 deletions(-)
> 
> diff --git a/cmd-choose-list.c b/cmd-choose-list.c
> index c3caabb..719adf3 100644
> --- a/cmd-choose-list.c
> +++ b/cmd-choose-list.c
> @@ -35,8 +35,8 @@ enum cmd_retval cmd_choose_list_exec(struct cmd *, struct 
> cmd_q *);
>  
>  const struct cmd_entry cmd_choose_list_entry = {
>       "choose-list", NULL,
> -     "l:t:", 0, 1,
> -     "[-l items] " CMD_TARGET_WINDOW_USAGE "[template]",
> +     "l:d:t:", 0, 1,
> +     "[-l items] [-d delim] " CMD_TARGET_WINDOW_USAGE "[template]",
>       0,
>       NULL,
>       cmd_choose_list_exec
> @@ -48,7 +48,7 @@ cmd_choose_list_exec(struct cmd *self, struct cmd_q *cmdq)
>       struct args                     *args = self->args;
>       struct client                   *c;
>       struct winlink                  *wl;
> -     const char                      *list1;
> +     const char                      *list1, *delim;
>       char                            *template, *item, *copy, *list;
>       u_int                            idx;
>  
> @@ -60,6 +60,9 @@ cmd_choose_list_exec(struct cmd *self, struct cmd_q *cmdq)
>       if ((list1 = args_get(args, 'l')) == NULL)
>               return (CMD_RETURN_ERROR);
>  
> +     if ((delim = args_get(args, 'd')) == NULL)
> +             delim = ",";
> +
>       if ((wl = cmd_find_window(cmdq, args_get(args, 't'), NULL)) == NULL)
>               return (CMD_RETURN_ERROR);
>  
> @@ -73,7 +76,7 @@ cmd_choose_list_exec(struct cmd *self, struct cmd_q *cmdq)
>  
>       copy = list = xstrdup(list1);
>       idx = 0;
> -     while ((item = strsep(&list, ",")) != NULL)
> +     while ((item = strsep(&list, delim)) != NULL)
>       {
>               if (*item == '\0') /* no empty entries */
>                       continue;
> diff --git a/tmux.1 b/tmux.1
> index 1146faf..68fa803 100644
> --- a/tmux.1
> +++ b/tmux.1
> @@ -1151,6 +1151,7 @@ This command works only if at least one client is 
> attached.
>  .It Xo
>  .Ic choose-list
>  .Op Fl l Ar items
> +.Op Fl d Ar delim
>  .Op Fl t Ar target-window
>  .Op Ar template
>  .Xc
> @@ -1159,6 +1160,9 @@ Put a window into list choice mode, allowing
>  to be selected.
>  .Ar items
>  can be a comma-separated list to display more than one item.
> +You can use
> +.Ar delim
> +to separate list instead of default comma delimiter.
>  If an item has spaces, that entry must be quoted.
>  After an item is chosen,
>  .Ql %%
> -- 
> 1.8.3.4 (Apple Git-47)
> 
> 
> 
> ------------------------------------------------------------------------------
> Sponsored by Intel(R) XDK 
> Develop, test and display web and hybrid apps with a single code base.
> Download it for free now!
> http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk
> _______________________________________________
> tmux-users mailing list
> tmux-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/tmux-users

------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today. 
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users

Reply via email to