Using space is a good idea but definitely don't want any help text
clutter. It would be nice to make ? key show all the key bindings for
modes when in that mode. Would need modes to nest though which might be
fiddly.



On Sun, Sep 30, 2012 at 08:00:39PM +0200, Romain Francoise wrote:
> Thomas Adam <tho...@xteddy.org> writes:
> 
> > This improves upon my original POC patch from the other day, to add in
> > support for expanding/collapsing sessions in choose-tree.
> 
> Thanks, I like it. Two minor suggestions:
> - the arrow keys are too far to reach for me, using Space to expand or
>   collapse the items would be nice. I implemented this in the following
>   patch, as a new toggle action.
> - for the sake of novice users, maybe we could add some help text on the
>   first line, e.g. "Session list - Return to select, Space to expand or
>   collapse"
> 
> diff --git a/mode-key.c b/mode-key.c
> index da068f1..dcbc63c 100644
> --- a/mode-key.c
> +++ b/mode-key.c
> @@ -79,6 +79,7 @@ const struct mode_key_cmdstr mode_key_cmdstr_choice[] = {
>       { MODEKEYCHOICE_CHOOSE, "choose" },
>       { MODEKEYCHOICE_COLLAPSE, "collapse" },
>       { MODEKEYCHOICE_COLLAPSE_ALL, "collapse-all" },
> +     { MODEKEYCHOICE_COLLAPSE_TOGGLE, "collapse-toggle" },
>       { MODEKEYCHOICE_DOWN, "down" },
>       { MODEKEYCHOICE_EXPAND, "expand" },
>       { MODEKEYCHOICE_EXPAND_ALL, "expand-all" },
> @@ -226,6 +227,7 @@ const struct mode_key_entry mode_key_vi_choice[] = {
>       { KEYC_RIGHT,           0, MODEKEYCHOICE_EXPAND },
>       { KEYC_LEFT | KEYC_CTRL,0, MODEKEYCHOICE_COLLAPSE_ALL },
>       { KEYC_RIGHT | KEYC_CTRL,0,MODEKEYCHOICE_EXPAND_ALL },
> +     { ' ',                  0, MODEKEYCHOICE_COLLAPSE_TOGGLE },
>  
>       { 0,                    -1, 0 }
>  };
> @@ -367,6 +369,7 @@ const struct mode_key_entry mode_key_emacs_choice[] = {
>       { KEYC_RIGHT,           0, MODEKEYCHOICE_EXPAND },
>       { KEYC_LEFT | KEYC_CTRL,0, MODEKEYCHOICE_COLLAPSE_ALL },
>       { KEYC_RIGHT | KEYC_CTRL,0,MODEKEYCHOICE_EXPAND_ALL },
> +     { ' ',                  0, MODEKEYCHOICE_COLLAPSE_TOGGLE },
>  
>       { 0,                    -1, 0 }
>  };
> diff --git a/tmux.h b/tmux.h
> index 09cb0ae..bd2d52e 100644
> --- a/tmux.h
> +++ b/tmux.h
> @@ -544,6 +544,7 @@ enum mode_key_cmd {
>       MODEKEYCHOICE_CHOOSE,
>       MODEKEYCHOICE_COLLAPSE,
>       MODEKEYCHOICE_COLLAPSE_ALL,
> +     MODEKEYCHOICE_COLLAPSE_TOGGLE,
>       MODEKEYCHOICE_DOWN,
>       MODEKEYCHOICE_EXPAND,
>       MODEKEYCHOICE_EXPAND_ALL,
> diff --git a/window-choose.c b/window-choose.c
> index 77eba8f..5f7ee2f 100644
> --- a/window-choose.c
> +++ b/window-choose.c
> @@ -377,6 +377,7 @@ window_choose_expand(struct window_pane *wp, struct 
> session *s, u_int pos)
>       for (i = items; i > 0; i--)
>       {
>               item = &ARRAY_ITEM(&data->list_orig, i);
> +             item->state |= TREE_EXPANDED;
>               wcd = item->wcd;
>  
>               if (s == wcd->tree_session) {
> @@ -481,6 +482,15 @@ window_choose_key(struct window_pane *wp, unused struct 
> session *sess, int key)
>       case MODEKEYCHOICE_EXPAND_ALL:
>               window_choose_expand_all(wp);
>               break;
> +     case MODEKEYCHOICE_COLLAPSE_TOGGLE:
> +             item = &ARRAY_ITEM(&data->list, data->selected);
> +             if (item->state & TREE_EXPANDED)
> +                     window_choose_collapse(wp, item->wcd->tree_session);
> +             else
> +                     window_choose_expand(wp, item->wcd->tree_session,
> +                                          data->selected);
> +             window_choose_redraw_screen(wp);
> +             break;
>       case MODEKEYCHOICE_UP:
>               if (items == 0)
>                       break;
> 
> ------------------------------------------------------------------------------
> Everyone hates slow websites. So do we.
> Make your web apps faster with AppDynamics
> Download AppDynamics Lite for free today:
> http://ad.doubleclick.net/clk;258768047;13503038;j?
> http://info.appdynamics.com/FreeJavaPerformanceDownload.html
> _______________________________________________
> tmux-users mailing list
> tmux-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/tmux-users

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://ad.doubleclick.net/clk;258768047;13503038;j?
http://info.appdynamics.com/FreeJavaPerformanceDownload.html
_______________________________________________
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users

Reply via email to