On Thu, Feb 04, 2010 at 06:01:24AM -0500, Paul Hoffman wrote:
> On Wed, Feb 03, 2010 at 10:06:20PM +0000, Nicholas Marriott wrote:
> > Looks fine, any chance of adding it to the man page too?
>
> Oops, I forgot all about that. I'm not familiar with the mdoc macro
> package, so it'll take me a little longer, but I'll give it a shot.
OK, here it is -- the changes in the man page should be the only thing
that's different from the previous patch.
Paul.
> > 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>
--
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.1 tmux-1.1/tmux.1
--- tmux-1.1-original/tmux.1 2009-11-04 17:46:25.000000000 -0500
+++ tmux-1.1/tmux.1 2010-02-04 06:09:22.000000000 -0500
@@ -712,9 +712,10 @@
Display a visible indicator of each pane shown by
.Ar target-client .
See the
-.Ic display-panes-time
+.Ic display-panes-time ,
+.Ic display-panes-colour ,
and
-.Ic display-panes-colour
+.Ic display-panes-active-colour
session options.
While the indicator is on screen, a pane may be selected with the
.Ql 0
@@ -1292,10 +1293,14 @@
be set to
.Ql screen
or a derivative of it.
+.It Ic display-panes-active-colour Ar colour
+Set the colour used by the
+.Ic display-panes
+command to show the indicator for the active pane.
.It Ic display-panes-colour Ar colour
-Set the colour used for the
+Set the colour used by the
.Ic display-panes
-command.
+command to show the indicators for inactive panes.
.It Ic display-panes-time Ar time
Set the time in milliseconds for which the indicators shown by the
.Ic display-panes
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