mirror of
				https://github.com/tmux/tmux.git
				synced 2025-10-26 12:27:15 +00:00 
			
		
		
		
	New flag: aggressize resize. Resize window when to size of smallest session for which it is _current_ window.
This commit is contained in:
		
							
								
								
									
										9
									
								
								CHANGES
									
									
									
									
									
								
							
							
						
						
									
										9
									
								
								CHANGES
									
									
									
									
									
								
							| @@ -1,5 +1,12 @@ | ||||
| 06 June 2008 | ||||
|  | ||||
| * New window option: aggressive-resize. Normally, windows are resized to the | ||||
|   size of the smallest attached session to which they are linked. This means a | ||||
|   window only changes size when sessions are detached or attached, or they are | ||||
|   linked or unlinked from a session. This flag changes a window to be the size | ||||
|   of the smallest attached session for which it is the current window - it is | ||||
|   resized every time a session changes to it or away from it. This is nice for | ||||
|   things that handle SIGWINCH well (like irssi) and bad for things like shells. | ||||
| * The server now exits when no sessions remain. | ||||
| * Fix bug with inserting characters with TERM=xterm-color. | ||||
|  | ||||
| @@ -445,4 +452,4 @@ | ||||
|   (including mutt, emacs). No status bar yet and no key remapping or other | ||||
|   customisation. | ||||
|  | ||||
| $Id: CHANGES,v 1.114 2008-06-06 17:55:27 nicm Exp $ | ||||
| $Id: CHANGES,v 1.115 2008-06-06 20:02:27 nicm Exp $ | ||||
|   | ||||
| @@ -1,4 +1,4 @@ | ||||
| /* $Id: cmd-kill-session.c,v 1.10 2008-06-05 21:25:00 nicm Exp $ */ | ||||
| /* $Id: cmd-kill-session.c,v 1.11 2008-06-06 20:02:27 nicm Exp $ */ | ||||
|  | ||||
| /* | ||||
|  * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> | ||||
| @@ -60,6 +60,7 @@ cmd_kill_session_exec(struct cmd *self, struct cmd_ctx *ctx) | ||||
| 			server_write_client(c, MSG_EXIT, NULL, 0); | ||||
| 		} | ||||
| 	} | ||||
| 	recalculate_sizes(); | ||||
|  | ||||
| 	session_destroy(s); | ||||
|  | ||||
|   | ||||
| @@ -1,4 +1,4 @@ | ||||
| /* $Id: cmd-kill-window.c,v 1.13 2008-06-05 21:25:00 nicm Exp $ */ | ||||
| /* $Id: cmd-kill-window.c,v 1.14 2008-06-06 20:02:27 nicm Exp $ */ | ||||
|  | ||||
| /* | ||||
|  * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> | ||||
| @@ -63,6 +63,7 @@ cmd_kill_window_exec(struct cmd *self, struct cmd_ctx *ctx) | ||||
| 		} else | ||||
| 			server_redraw_client(c); | ||||
| 	} | ||||
| 	recalculate_sizes(); | ||||
|  | ||||
| 	if (ctx->cmdclient != NULL) | ||||
| 		server_write_client(ctx->cmdclient, MSG_EXIT, NULL, 0); | ||||
|   | ||||
| @@ -1,4 +1,4 @@ | ||||
| /* $Id: cmd-last-window.c,v 1.11 2008-06-05 21:25:00 nicm Exp $ */ | ||||
| /* $Id: cmd-last-window.c,v 1.12 2008-06-06 20:02:27 nicm Exp $ */ | ||||
|  | ||||
| /* | ||||
|  * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> | ||||
| @@ -52,6 +52,7 @@ cmd_last_window_exec(struct cmd *self, struct cmd_ctx *ctx) | ||||
| 		server_redraw_session(s); | ||||
| 	else | ||||
| 		ctx->error(ctx, "no last window"); | ||||
| 	recalculate_sizes(); | ||||
|  | ||||
| 	if (ctx->cmdclient != NULL) | ||||
| 		server_write_client(ctx->cmdclient, MSG_EXIT, NULL, 0); | ||||
|   | ||||
| @@ -1,4 +1,4 @@ | ||||
| /* $Id: cmd-link-window.c,v 1.21 2008-06-06 17:20:15 nicm Exp $ */ | ||||
| /* $Id: cmd-link-window.c,v 1.22 2008-06-06 20:02:27 nicm Exp $ */ | ||||
|  | ||||
| /* | ||||
|  * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> | ||||
| @@ -108,6 +108,7 @@ cmd_link_window_exec(struct cmd *self, struct cmd_ctx *ctx) | ||||
| 		session_select(s, wl_dst->idx); | ||||
| 		server_redraw_session(s); | ||||
| 	} | ||||
| 	recalculate_sizes(); | ||||
|  | ||||
| out: | ||||
| 	if (ctx->cmdclient != NULL) | ||||
|   | ||||
| @@ -1,4 +1,4 @@ | ||||
| /* $Id: cmd-next-window.c,v 1.11 2008-06-05 21:25:00 nicm Exp $ */ | ||||
| /* $Id: cmd-next-window.c,v 1.12 2008-06-06 20:02:27 nicm Exp $ */ | ||||
|  | ||||
| /* | ||||
|  * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> | ||||
| @@ -52,6 +52,7 @@ cmd_next_window_exec(struct cmd *self, struct cmd_ctx *ctx) | ||||
| 		server_redraw_session(s); | ||||
| 	else | ||||
| 		ctx->error(ctx, "no next window"); | ||||
| 	recalculate_sizes(); | ||||
|  | ||||
| 	if (ctx->cmdclient != NULL) | ||||
| 		server_write_client(ctx->cmdclient, MSG_EXIT, NULL, 0); | ||||
|   | ||||
| @@ -1,4 +1,4 @@ | ||||
| /* $Id: cmd-previous-window.c,v 1.11 2008-06-05 21:25:00 nicm Exp $ */ | ||||
| /* $Id: cmd-previous-window.c,v 1.12 2008-06-06 20:02:27 nicm Exp $ */ | ||||
|  | ||||
| /* | ||||
|  * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> | ||||
| @@ -52,6 +52,7 @@ cmd_previous_window_exec(struct cmd *self, struct cmd_ctx *ctx) | ||||
| 		server_redraw_session(s); | ||||
| 	else | ||||
| 		ctx->error(ctx, "no previous window"); | ||||
| 	recalculate_sizes(); | ||||
|  | ||||
| 	if (ctx->cmdclient != NULL) | ||||
| 		server_write_client(ctx->cmdclient, MSG_EXIT, NULL, 0); | ||||
|   | ||||
| @@ -1,4 +1,4 @@ | ||||
| /* $Id: cmd-select-window.c,v 1.18 2008-06-05 21:25:00 nicm Exp $ */ | ||||
| /* $Id: cmd-select-window.c,v 1.19 2008-06-06 20:02:27 nicm Exp $ */ | ||||
|  | ||||
| /* | ||||
|  * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> | ||||
| @@ -66,6 +66,7 @@ cmd_select_window_exec(struct cmd *self, struct cmd_ctx *ctx) | ||||
|  | ||||
| 	if (session_select(s, wl->idx) == 0) | ||||
| 		server_redraw_session(s); | ||||
| 	recalculate_sizes(); | ||||
|  | ||||
| 	if (ctx->cmdclient != NULL) | ||||
| 		server_write_client(ctx->cmdclient, MSG_EXIT, NULL, 0); | ||||
|   | ||||
| @@ -1,4 +1,4 @@ | ||||
| /* $Id: cmd-set-window-option.c,v 1.5 2008-06-05 21:25:00 nicm Exp $ */ | ||||
| /* $Id: cmd-set-window-option.c,v 1.6 2008-06-06 20:02:27 nicm Exp $ */ | ||||
|  | ||||
| /* | ||||
|  * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> | ||||
| @@ -150,6 +150,22 @@ cmd_set_window_option_exec(struct cmd *self, struct cmd_ctx *ctx) | ||||
| 			if (s != NULL) | ||||
| 				session_alert_cancel(s, wl); | ||||
| 		} | ||||
| 	} else if (strcmp(data->option, "aggressive-resize") == 0) { | ||||
| 		if (bool == -1) { | ||||
| 			ctx->error(ctx, "bad value: %s", data->value); | ||||
| 			return; | ||||
| 		} | ||||
|  | ||||
| 		if (bool == -2) | ||||
| 			wl->window->flags ^= WINDOW_AGGRESSIVE; | ||||
| 		else { | ||||
| 			if (bool) | ||||
| 				wl->window->flags |= WINDOW_AGGRESSIVE; | ||||
| 			else  | ||||
| 				wl->window->flags &= ~WINDOW_AGGRESSIVE; | ||||
| 		} | ||||
|  | ||||
| 		recalculate_sizes(); | ||||
| 	} else { | ||||
| 		ctx->error(ctx, "unknown option: %s", data->option); | ||||
| 		return; | ||||
|   | ||||
| @@ -1,4 +1,4 @@ | ||||
| /* $Id: cmd-swap-window.c,v 1.12 2008-06-05 22:59:38 nicm Exp $ */ | ||||
| /* $Id: cmd-swap-window.c,v 1.13 2008-06-06 20:02:27 nicm Exp $ */ | ||||
|  | ||||
| /* | ||||
|  * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> | ||||
| @@ -70,6 +70,7 @@ cmd_swap_window_exec(struct cmd *self, struct cmd_ctx *ctx) | ||||
| 	server_redraw_session(src); | ||||
| 	if (src != dst) | ||||
| 		server_redraw_session(dst); | ||||
| 	recalculate_sizes(); | ||||
|  | ||||
| out: | ||||
| 	if (ctx->cmdclient != NULL) | ||||
|   | ||||
| @@ -1,4 +1,4 @@ | ||||
| /* $Id: cmd-unlink-window.c,v 1.11 2008-06-05 21:25:00 nicm Exp $ */ | ||||
| /* $Id: cmd-unlink-window.c,v 1.12 2008-06-06 20:02:27 nicm Exp $ */ | ||||
|  | ||||
| /* | ||||
|  * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> | ||||
| @@ -68,6 +68,7 @@ cmd_unlink_window_exec(struct cmd *self, struct cmd_ctx *ctx) | ||||
| 		} else | ||||
| 			server_redraw_client(c); | ||||
| 	} | ||||
| 	recalculate_sizes(); | ||||
|  | ||||
| 	if (ctx->cmdclient != NULL) | ||||
| 		server_write_client(ctx->cmdclient, MSG_EXIT, NULL, 0); | ||||
|   | ||||
							
								
								
									
										10
									
								
								resize.c
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								resize.c
									
									
									
									
									
								
							| @@ -1,4 +1,4 @@ | ||||
| /* $Id: resize.c,v 1.11 2008-06-03 21:42:37 nicm Exp $ */ | ||||
| /* $Id: resize.c,v 1.12 2008-06-06 20:02:27 nicm Exp $ */ | ||||
|  | ||||
| /* | ||||
|  * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> | ||||
| @@ -48,7 +48,7 @@ recalculate_sizes(void) | ||||
| 	struct session	*s; | ||||
| 	struct client	*c; | ||||
| 	struct window	*w; | ||||
| 	u_int		 i, j, ssx, ssy, slines; | ||||
| 	u_int		 i, j, ssx, ssy, slines, has; | ||||
|  | ||||
| 	for (i = 0; i < ARRAY_LENGTH(&sessions); i++) { | ||||
| 		s = ARRAY_ITEM(&sessions, i); | ||||
| @@ -97,7 +97,11 @@ recalculate_sizes(void) | ||||
| 			s = ARRAY_ITEM(&sessions, j); | ||||
| 			if (s == NULL || s->flags & SESSION_UNATTACHED) | ||||
| 				continue; | ||||
| 			if (session_has(s, w)) { | ||||
| 			if (w->flags & WINDOW_AGGRESSIVE) | ||||
| 				has = s->curw->window == w; | ||||
| 			else | ||||
| 				has = session_has(s, w); | ||||
| 			if (has) { | ||||
| 				if (s->sx < ssx) | ||||
| 					ssx = s->sx; | ||||
| 				if (s->sy < ssy) | ||||
|   | ||||
							
								
								
									
										3
									
								
								tmux.h
									
									
									
									
									
								
							
							
						
						
									
										3
									
								
								tmux.h
									
									
									
									
									
								
							| @@ -1,4 +1,4 @@ | ||||
| /* $Id: tmux.h,v 1.135 2008-06-06 17:55:27 nicm Exp $ */ | ||||
| /* $Id: tmux.h,v 1.136 2008-06-06 20:02:27 nicm Exp $ */ | ||||
|  | ||||
| /* | ||||
|  * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> | ||||
| @@ -527,6 +527,7 @@ struct window { | ||||
| #define WINDOW_HIDDEN 0x2 | ||||
| #define WINDOW_ACTIVITY 0x4 | ||||
| #define WINDOW_MONITOR 0x8 | ||||
| #define WINDOW_AGGRESSIVE 0x10 | ||||
|  | ||||
| 	struct screen	*screen; | ||||
| 	struct screen	 base; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Nicholas Marriott
					Nicholas Marriott