mirror of
				https://github.com/tmux/tmux.git
				synced 2025-10-26 12:27:15 +00:00 
			
		
		
		
	Change so that sessions created detached (-d or no client) are always
80x24 and the status line is not applied until they attach. Also make -x and -y work for control clients whether the session is detached or not.
This commit is contained in:
		| @@ -77,6 +77,7 @@ cmd_new_session_exec(struct cmd *self, struct cmdq_item *item) | ||||
| 	const char		*path, *cmd, *cwd, *to_free = NULL; | ||||
| 	char		       **argv, *cause, *cp; | ||||
| 	int			 detached, already_attached, idx, argc; | ||||
| 	int			 is_control = 0; | ||||
| 	u_int			 sx, sy; | ||||
| 	struct environ_entry	*envent; | ||||
| 	struct cmd_find_state	 fs; | ||||
| @@ -139,6 +140,8 @@ cmd_new_session_exec(struct cmd *self, struct cmdq_item *item) | ||||
| 	detached = args_has(args, 'd'); | ||||
| 	if (c == NULL) | ||||
| 		detached = 1; | ||||
| 	else if (c->flags & CLIENT_CONTROL) | ||||
| 		is_control = 1; | ||||
|  | ||||
| 	/* Is this client already attached? */ | ||||
| 	already_attached = 0; | ||||
| @@ -185,29 +188,31 @@ cmd_new_session_exec(struct cmd *self, struct cmdq_item *item) | ||||
| 	} | ||||
|  | ||||
| 	/* Find new session size. */ | ||||
| 	if (c != NULL) { | ||||
| 	if (!detached) { | ||||
| 		sx = c->tty.sx; | ||||
| 		sy = c->tty.sy; | ||||
| 		if (!is_control && | ||||
| 		    sy > 0 && | ||||
| 		    options_get_number(global_s_options, "status")) | ||||
| 			sy--; | ||||
| 	} else { | ||||
| 		sx = 80; | ||||
| 		sy = 24; | ||||
| 	} | ||||
| 	if (detached && args_has(args, 'x')) { | ||||
| 	if ((is_control || detached) && args_has(args, 'x')) { | ||||
| 		sx = strtonum(args_get(args, 'x'), 1, USHRT_MAX, &errstr); | ||||
| 		if (errstr != NULL) { | ||||
| 			cmdq_error(item, "width %s", errstr); | ||||
| 			goto error; | ||||
| 		} | ||||
| 	} | ||||
| 	if (detached && args_has(args, 'y')) { | ||||
| 	if ((is_control || detached) && args_has(args, 'y')) { | ||||
| 		sy = strtonum(args_get(args, 'y'), 1, USHRT_MAX, &errstr); | ||||
| 		if (errstr != NULL) { | ||||
| 			cmdq_error(item, "height %s", errstr); | ||||
| 			goto error; | ||||
| 		} | ||||
| 	} | ||||
| 	if (sy > 0 && options_get_number(global_s_options, "status")) | ||||
| 		sy--; | ||||
| 	if (sx == 0) | ||||
| 		sx = 1; | ||||
| 	if (sy == 0) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 nicm
					nicm