mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 00:56:10 +00:00 
			
		
		
		
	Sync OpenBSD patchset 632:
Option to display the active pane in a different colour with the display-panes command. From Paul Hoffman, thanks.
This commit is contained in:
		@@ -1,4 +1,4 @@
 | 
			
		||||
/* $Id: cmd-set-option.c,v 1.93 2010-01-05 23:52:37 tcunha Exp $ */
 | 
			
		||||
/* $Id: cmd-set-option.c,v 1.94 2010-02-05 01:31:06 tcunha Exp $ */
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
 | 
			
		||||
@@ -88,6 +88,7 @@ const struct set_option_entry set_session_option_table[] = {
 | 
			
		||||
	{ "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 },
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
/* $Id: screen-redraw.c,v 1.51 2010-01-05 23:52:37 tcunha Exp $ */
 | 
			
		||||
/* $Id: screen-redraw.c,v 1.52 2010-02-05 01:31:06 tcunha Exp $ */
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
 | 
			
		||||
@@ -269,18 +269,21 @@ screen_redraw_draw_number(struct client *c, struct window_pane *wp)
 | 
			
		||||
{
 | 
			
		||||
	struct tty		*tty = &c->tty;
 | 
			
		||||
	struct session		*s = c->session;
 | 
			
		||||
	struct options	        *oo = &s->options;
 | 
			
		||||
	struct window		*w = wp->window;
 | 
			
		||||
	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;
 | 
			
		||||
 | 
			
		||||
	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");
 | 
			
		||||
	colour = options_get_number(oo, "display-panes-colour");
 | 
			
		||||
	active_colour = options_get_number(oo, "display-panes-active-colour");
 | 
			
		||||
 | 
			
		||||
	px = wp->sx / 2; py = wp->sy / 2;
 | 
			
		||||
	xoff = wp->xoff; yoff = wp->yoff;
 | 
			
		||||
@@ -289,7 +292,10 @@ screen_redraw_draw_number(struct client *c, struct window_pane *wp)
 | 
			
		||||
		tty_cursor(tty, xoff + px - len / 2, yoff + py);
 | 
			
		||||
		memcpy(&gc, &grid_default_cell, sizeof gc);
 | 
			
		||||
		gc.data = '_'; /* not space */
 | 
			
		||||
		colour_set_fg(&gc, colour);
 | 
			
		||||
		if (w->active == wp)
 | 
			
		||||
			colour_set_fg(&gc, active_colour);
 | 
			
		||||
		else
 | 
			
		||||
			colour_set_fg(&gc, colour);
 | 
			
		||||
		tty_attributes(tty, &gc);
 | 
			
		||||
		tty_puts(tty, buf);
 | 
			
		||||
		return;
 | 
			
		||||
@@ -300,7 +306,10 @@ screen_redraw_draw_number(struct client *c, struct window_pane *wp)
 | 
			
		||||
 | 
			
		||||
	memcpy(&gc, &grid_default_cell, sizeof gc);
 | 
			
		||||
	gc.data = '_'; /* not space */
 | 
			
		||||
	colour_set_bg(&gc, colour);
 | 
			
		||||
	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++) {
 | 
			
		||||
		if (*ptr < '0' || *ptr > '9')
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										19
									
								
								tmux.1
									
									
									
									
									
								
							
							
						
						
									
										19
									
								
								tmux.1
									
									
									
									
									
								
							@@ -1,4 +1,4 @@
 | 
			
		||||
.\" $Id: tmux.1,v 1.226 2010-01-28 22:48:04 tcunha Exp $
 | 
			
		||||
.\" $Id: tmux.1,v 1.227 2010-02-05 01:31:06 tcunha Exp $
 | 
			
		||||
.\"
 | 
			
		||||
.\" Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
 | 
			
		||||
.\"
 | 
			
		||||
@@ -14,7 +14,7 @@
 | 
			
		||||
.\" IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
 | 
			
		||||
.\" OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 | 
			
		||||
.\"
 | 
			
		||||
.Dd $Mdocdate: January 28 2010 $
 | 
			
		||||
.Dd $Mdocdate: February 4 2010 $
 | 
			
		||||
.Dt TMUX 1
 | 
			
		||||
.Os
 | 
			
		||||
.Sh NAME
 | 
			
		||||
@@ -751,9 +751,10 @@ This command works only from inside
 | 
			
		||||
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
 | 
			
		||||
@@ -1398,10 +1399,14 @@ to work correctly, this
 | 
			
		||||
be set to
 | 
			
		||||
.Ql screen
 | 
			
		||||
or a derivative of it.
 | 
			
		||||
.It Ic display-panes-colour Ar colour
 | 
			
		||||
Set the colour used for the
 | 
			
		||||
.It Ic display-panes-active-colour Ar colour
 | 
			
		||||
Set the colour used by the
 | 
			
		||||
.Ic display-panes
 | 
			
		||||
command.
 | 
			
		||||
command to show the indicator for the active pane.
 | 
			
		||||
.It Ic display-panes-colour Ar colour
 | 
			
		||||
Set the colour used by the
 | 
			
		||||
.Ic display-panes
 | 
			
		||||
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
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										3
									
								
								tmux.c
									
									
									
									
									
								
							
							
						
						
									
										3
									
								
								tmux.c
									
									
									
									
									
								
							@@ -1,4 +1,4 @@
 | 
			
		||||
/* $Id: tmux.c,v 1.197 2010-01-05 23:52:37 tcunha Exp $ */
 | 
			
		||||
/* $Id: tmux.c,v 1.198 2010-02-05 01:31:06 tcunha Exp $ */
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
 | 
			
		||||
@@ -331,6 +331,7 @@ main(int argc, char **argv)
 | 
			
		||||
	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);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user