Move the nested check from client to server and compare the client tty

name to all the pane pty names instead of comparing socket paths. This
means that "new -d" will work without unsetting $TMUX.
This commit is contained in:
nicm
2015-06-04 23:27:51 +00:00
parent dc0d34e137
commit 6b2129696f
5 changed files with 42 additions and 25 deletions

View File

@@ -46,6 +46,27 @@ void server_client_msg_command(struct client *, struct imsg *);
void server_client_msg_identify(struct client *, struct imsg *);
void server_client_msg_shell(struct client *);
/* Check if this client is inside this server. */
int
server_client_check_nested(struct client *c)
{
struct environ_entry *envent;
struct window_pane *wp;
if (c->tty.path == NULL)
return (0);
envent = environ_find(&c->environ, "TMUX");
if (envent == NULL || *envent->value == '\0')
return (0);
RB_FOREACH(wp, window_pane_tree, &all_window_panes) {
if (strcmp(wp->tty, c->tty.path) == 0)
return (1);
}
return (0);
}
/* Set client key table. */
void
server_client_key_table(struct client *c, const char *name)