mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 09:26:05 +00:00 
			
		
		
		
	Sync OpenBSD patchset 147:
Add a status-justify option to allow the window list in the status line to be positioned at the left, centre, or right.
This commit is contained in:
		@@ -1,4 +1,4 @@
 | 
				
			|||||||
/* $Id: cmd-set-option.c,v 1.68 2009-07-19 14:35:56 tcunha Exp $ */
 | 
					/* $Id: cmd-set-option.c,v 1.69 2009-07-20 16:01:07 tcunha Exp $ */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
 | 
					 * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
 | 
				
			||||||
@@ -45,6 +45,9 @@ const struct cmd_entry cmd_set_option_entry = {
 | 
				
			|||||||
const char *set_option_status_keys_list[] = {
 | 
					const char *set_option_status_keys_list[] = {
 | 
				
			||||||
	"emacs", "vi", NULL
 | 
						"emacs", "vi", NULL
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					const char *set_option_status_justify_list[] = {
 | 
				
			||||||
 | 
						"left", "centre", "right", NULL
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
const char *set_option_bell_action_list[] = {
 | 
					const char *set_option_bell_action_list[] = {
 | 
				
			||||||
	"none", "any", "current", NULL
 | 
						"none", "any", "current", NULL
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
@@ -69,6 +72,8 @@ const struct set_option_entry set_option_table[] = {
 | 
				
			|||||||
	{ "status-bg", SET_OPTION_COLOUR, 0, 0, NULL },
 | 
						{ "status-bg", SET_OPTION_COLOUR, 0, 0, NULL },
 | 
				
			||||||
	{ "status-fg", SET_OPTION_COLOUR, 0, 0, NULL },
 | 
						{ "status-fg", SET_OPTION_COLOUR, 0, 0, NULL },
 | 
				
			||||||
	{ "status-interval", SET_OPTION_NUMBER, 0, INT_MAX, NULL },
 | 
						{ "status-interval", SET_OPTION_NUMBER, 0, INT_MAX, NULL },
 | 
				
			||||||
 | 
						{ "status-justify", 
 | 
				
			||||||
 | 
						  SET_OPTION_CHOICE, 0, 0, set_option_status_justify_list },
 | 
				
			||||||
	{ "status-keys", SET_OPTION_CHOICE, 0, 0, set_option_status_keys_list },
 | 
						{ "status-keys", SET_OPTION_CHOICE, 0, 0, set_option_status_keys_list },
 | 
				
			||||||
	{ "status-left", SET_OPTION_STRING, 0, 0, NULL },
 | 
						{ "status-left", SET_OPTION_STRING, 0, 0, NULL },
 | 
				
			||||||
	{ "status-left-length", SET_OPTION_NUMBER, 0, SHRT_MAX, NULL },
 | 
						{ "status-left-length", SET_OPTION_NUMBER, 0, SHRT_MAX, NULL },
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										19
									
								
								status.c
									
									
									
									
									
								
							
							
						
						
									
										19
									
								
								status.c
									
									
									
									
									
								
							@@ -1,4 +1,4 @@
 | 
				
			|||||||
/* $Id: status.c,v 1.99 2009-07-20 15:57:05 tcunha Exp $ */
 | 
					/* $Id: status.c,v 1.100 2009-07-20 16:01:07 tcunha Exp $ */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
 | 
					 * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
 | 
				
			||||||
@@ -46,7 +46,7 @@ status_redraw(struct client *c)
 | 
				
			|||||||
	struct screen		      	old_status;
 | 
						struct screen		      	old_status;
 | 
				
			||||||
	char		 	       *left, *right, *text, *ptr;
 | 
						char		 	       *left, *right, *text, *ptr;
 | 
				
			||||||
	size_t				llen, llen2, rlen, rlen2, offset;
 | 
						size_t				llen, llen2, rlen, rlen2, offset;
 | 
				
			||||||
	size_t				xx, yy, size, start, width;
 | 
						size_t				ox, xx, yy, size, start, width;
 | 
				
			||||||
	struct grid_cell	        stdgc, gc;
 | 
						struct grid_cell	        stdgc, gc;
 | 
				
			||||||
	int				larrow, rarrow, utf8flag;
 | 
						int				larrow, rarrow, utf8flag;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -175,6 +175,21 @@ draw:
 | 
				
			|||||||
			screen_write_cursormove(&ctx, 0, yy);
 | 
								screen_write_cursormove(&ctx, 0, yy);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						ox = 0;
 | 
				
			||||||
 | 
						if (width < xx) {
 | 
				
			||||||
 | 
							switch (options_get_number(&s->options, "status-justify")) {
 | 
				
			||||||
 | 
							case 1:	/* centered */
 | 
				
			||||||
 | 
								ox = 1 + (xx - width) / 2;
 | 
				
			||||||
 | 
								break;
 | 
				
			||||||
 | 
							case 2:	/* right */
 | 
				
			||||||
 | 
								ox = 1 + (xx - width);
 | 
				
			||||||
 | 
								break;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							xx -= ox;
 | 
				
			||||||
 | 
							while (ox-- > 0)
 | 
				
			||||||
 | 
								screen_write_putc(&ctx, &stdgc, ' ');
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* Draw each character in succession. */
 | 
						/* Draw each character in succession. */
 | 
				
			||||||
	offset = 0;
 | 
						offset = 0;
 | 
				
			||||||
	RB_FOREACH(wl, winlinks, &s->windows) {
 | 
						RB_FOREACH(wl, winlinks, &s->windows) {
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										7
									
								
								tmux.1
									
									
									
									
									
								
							
							
						
						
									
										7
									
								
								tmux.1
									
									
									
									
									
								
							@@ -1,4 +1,4 @@
 | 
				
			|||||||
.\" $Id: tmux.1,v 1.126 2009-07-20 15:57:05 tcunha Exp $
 | 
					.\" $Id: tmux.1,v 1.127 2009-07-20 16:01:07 tcunha Exp $
 | 
				
			||||||
.\"
 | 
					.\"
 | 
				
			||||||
.\" Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
 | 
					.\" Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
 | 
				
			||||||
.\"
 | 
					.\"
 | 
				
			||||||
@@ -1262,6 +1262,11 @@ Update the status bar every
 | 
				
			|||||||
seconds.
 | 
					seconds.
 | 
				
			||||||
By default, updates will occur every 15 seconds.
 | 
					By default, updates will occur every 15 seconds.
 | 
				
			||||||
A setting of zero disables redrawing at interval.
 | 
					A setting of zero disables redrawing at interval.
 | 
				
			||||||
 | 
					.It Xo Ic status-justify
 | 
				
			||||||
 | 
					.Op Ic left | Ic centre | Ic right
 | 
				
			||||||
 | 
					.Xc
 | 
				
			||||||
 | 
					Set the position of the window list component of the status line: left, centre
 | 
				
			||||||
 | 
					or right justified.
 | 
				
			||||||
.It Xo Ic status-keys
 | 
					.It Xo Ic status-keys
 | 
				
			||||||
.Op Ic vi | Ic emacs
 | 
					.Op Ic vi | Ic emacs
 | 
				
			||||||
.Xc
 | 
					.Xc
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										3
									
								
								tmux.c
									
									
									
									
									
								
							
							
						
						
									
										3
									
								
								tmux.c
									
									
									
									
									
								
							@@ -1,4 +1,4 @@
 | 
				
			|||||||
/* $Id: tmux.c,v 1.145 2009-07-20 15:57:05 tcunha Exp $ */
 | 
					/* $Id: tmux.c,v 1.146 2009-07-20 16:01:07 tcunha Exp $ */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
 | 
					 * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
 | 
				
			||||||
@@ -312,6 +312,7 @@ main(int argc, char **argv)
 | 
				
			|||||||
	options_set_number(&global_s_options, "status-fg", 0);
 | 
						options_set_number(&global_s_options, "status-fg", 0);
 | 
				
			||||||
	options_set_number(&global_s_options, "status-interval", 15);
 | 
						options_set_number(&global_s_options, "status-interval", 15);
 | 
				
			||||||
	options_set_number(&global_s_options, "status-keys", MODEKEY_EMACS);
 | 
						options_set_number(&global_s_options, "status-keys", MODEKEY_EMACS);
 | 
				
			||||||
 | 
						options_set_number(&global_s_options, "status-justify", 0);
 | 
				
			||||||
	options_set_number(&global_s_options, "status-left-length", 10);
 | 
						options_set_number(&global_s_options, "status-left-length", 10);
 | 
				
			||||||
	options_set_number(&global_s_options, "status-right-length", 40);
 | 
						options_set_number(&global_s_options, "status-right-length", 40);
 | 
				
			||||||
	options_set_string(&global_s_options, "status-left", "[#S]");
 | 
						options_set_string(&global_s_options, "status-left", "[#S]");
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user