mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 00:56:10 +00:00 
			
		
		
		
	Allow attach-session -t to accept a window and pane to select them on
attach. Based on a diff from J Raynor.
This commit is contained in:
		@@ -47,6 +47,9 @@ cmd_attach_session(struct cmd_q *cmdq, const char *tflag, int dflag, int rflag,
 | 
			
		||||
{
 | 
			
		||||
	struct session		*s;
 | 
			
		||||
	struct client		*c;
 | 
			
		||||
	struct winlink		*wl = NULL;
 | 
			
		||||
	struct window		*w = NULL;
 | 
			
		||||
	struct window_pane	*wp = NULL;
 | 
			
		||||
	const char		*update;
 | 
			
		||||
	char			*cause;
 | 
			
		||||
	u_int			 i;
 | 
			
		||||
@@ -59,12 +62,31 @@ cmd_attach_session(struct cmd_q *cmdq, const char *tflag, int dflag, int rflag,
 | 
			
		||||
		return (CMD_RETURN_ERROR);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if ((s = cmd_find_session(cmdq, tflag, 1)) == NULL)
 | 
			
		||||
		return (CMD_RETURN_ERROR);
 | 
			
		||||
	if (tflag == NULL) {
 | 
			
		||||
		if ((s = cmd_find_session(cmdq, tflag, 1)) == NULL)
 | 
			
		||||
			return (CMD_RETURN_ERROR);
 | 
			
		||||
	} else if (tflag[strcspn(tflag, ":.")] != '\0') {
 | 
			
		||||
		if ((wl = cmd_find_pane(cmdq, tflag, &s, &wp)) == NULL)
 | 
			
		||||
			return (CMD_RETURN_ERROR);
 | 
			
		||||
	} else {
 | 
			
		||||
		if ((s = cmd_find_session(cmdq, tflag, 1)) == NULL)
 | 
			
		||||
			return (CMD_RETURN_ERROR);
 | 
			
		||||
		w = cmd_lookup_windowid(tflag);
 | 
			
		||||
		if (w == NULL && (wp = cmd_lookup_paneid(tflag)) != NULL)
 | 
			
		||||
			w = wp->window;
 | 
			
		||||
		if (w != NULL)
 | 
			
		||||
			wl = winlink_find_by_window(&s->windows, w);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (cmdq->client == NULL)
 | 
			
		||||
		return (CMD_RETURN_NORMAL);
 | 
			
		||||
 | 
			
		||||
	if (wl != NULL) {
 | 
			
		||||
		if (wp != NULL)
 | 
			
		||||
			window_set_active_pane(wp->window, wp);
 | 
			
		||||
		session_set_current(s, wl);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (cmdq->client->session != NULL) {
 | 
			
		||||
		if (dflag) {
 | 
			
		||||
			/*
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user