Looks fine, any chance of adding it to the man page too?

On Wed, Feb 03, 2010 at 08:06:27AM -0500, Paul Hoffman wrote:
> The attached patch causes the display-panes command to show the active
> pane's number in a distinct color so that you can see at glance which
> pane you're in.
> 
> The patch also introduces a new option, display-panes-active-colour, to
> control this.
> 
> I wrote it because I have a tendency to lose track of which pane I'm in.
> (I would also love to have a "display-active-pane" command that shows the
> pane number -- or some other indicator -- *only* in the active pane, but
> that looks harder to implement.)
> 
> I'm not sure if the patch will apply cleanly against the current code
> base; I based the changes on the 1.1 release code.  If this is a problem
> I'd be happy to redo it, but I thought I'd get this out there sooner
> rather than later.
> 
> Paul.
> 
> -- 
> Paul Hoffman <nkui...@nkuitse.com>

> diff -u -r -b tmux-1.1-original/cmd-set-option.c tmux-1.1/cmd-set-option.c
> --- tmux-1.1-original/cmd-set-option.c        2009-11-02 16:38:26.000000000 
> -0500
> +++ tmux-1.1/cmd-set-option.c 2010-02-02 19:11:45.000000000 -0500
> @@ -58,6 +58,7 @@
>       { "default-shell", SET_OPTION_STRING, 0, 0, NULL },
>       { "default-terminal", SET_OPTION_STRING, 0, 0, NULL },
>       { "display-panes-colour", SET_OPTION_COLOUR, 0, 0, NULL },
> +     { "display-panes-active-colour", SET_OPTION_COLOUR, 0, 0, NULL },
>       { "display-panes-time", SET_OPTION_NUMBER, 1, INT_MAX, NULL },
>       { "display-time", SET_OPTION_NUMBER, 1, INT_MAX, NULL },
>       { "history-limit", SET_OPTION_NUMBER, 0, INT_MAX, NULL },
> diff -u -r -b tmux-1.1-original/screen-redraw.c tmux-1.1/screen-redraw.c
> --- tmux-1.1-original/screen-redraw.c 2009-10-28 19:17:28.000000000 -0400
> +++ tmux-1.1/screen-redraw.c  2010-02-02 19:10:15.000000000 -0500
> @@ -240,16 +240,18 @@
>       struct session          *s = c->session;
>       struct grid_cell         gc;
>       u_int                    idx, px, py, i, j, xoff, yoff;
> -     int                      colour;
> +     int                      colour, active_colour;
>       char                     buf[16], *ptr;
>       size_t                   len;
> +     struct window           *w = wp->window;
>  
> -     idx = window_pane_index(wp->window, wp);
> +     idx = window_pane_index(w, wp);
>       len = xsnprintf(buf, sizeof buf, "%u", idx);
>  
>       if (wp->sx < len)
>               return;
>       colour = options_get_number(&s->options, "display-panes-colour");
> +     active_colour = options_get_number(&s->options, 
> "display-panes-active-colour");
>  
>       px = wp->sx / 2; py = wp->sy / 2;
>       xoff = wp->xoff; yoff = wp->yoff;
> @@ -258,6 +260,9 @@
>               tty_cursor(tty, xoff + px - len / 2, yoff + py);
>               memcpy(&gc, &grid_default_cell, sizeof gc);
>               gc.data = '_'; /* not space */
> +             if (w->active == wp)
> +                     colour_set_fg(&gc, active_colour);
> +             else
>               colour_set_fg(&gc, colour);
>               tty_attributes(tty, &gc);
>               tty_puts(tty, buf);
> @@ -269,6 +274,9 @@
>  
>       memcpy(&gc, &grid_default_cell, sizeof gc);
>       gc.data = '_'; /* not space */
> +     if (w->active == wp)
> +             colour_set_bg(&gc, active_colour);
> +     else
>       colour_set_bg(&gc, colour);
>       tty_attributes(tty, &gc);
>       for (ptr = buf; *ptr != '\0'; ptr++) {
> diff -u -r -b tmux-1.1-original/tmux.c tmux-1.1/tmux.c
> --- tmux-1.1-original/tmux.c  2009-11-04 18:09:09.000000000 -0500
> +++ tmux-1.1/tmux.c   2010-02-02 19:12:12.000000000 -0500
> @@ -394,6 +394,7 @@
>       options_set_string(so, "default-shell", "%s", getshell());
>       options_set_string(so, "default-terminal", "screen");
>       options_set_number(so, "display-panes-colour", 4);
> +     options_set_number(so, "display-panes-active-colour", 1);
>       options_set_number(so, "display-panes-time", 1000);
>       options_set_number(so, "display-time", 750);
>       options_set_number(so, "history-limit", 2000);

> ------------------------------------------------------------------------------
> The Planet: dedicated and managed hosting, cloud storage, colocation
> Stay online with enterprise data centers and the best network in the business
> Choose flexible plans and management services without long-term contracts
> Personal 24x7 support from experience hosting pros just a phone call away.
> http://p.sf.net/sfu/theplanet-com

> _______________________________________________
> tmux-users mailing list
> tmux-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/tmux-users


------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users

Reply via email to