diff --git a/cmd-find.c b/cmd-find.c index 87ca7310..2d3adf40 100644 --- a/cmd-find.c +++ b/cmd-find.c @@ -82,6 +82,7 @@ cmd_find_try_TMUX(struct client *c) char tmp[256]; long long pid; u_int session; + struct session *s; envent = environ_find(c->environ, "TMUX"); if (envent == NULL) @@ -91,8 +92,13 @@ cmd_find_try_TMUX(struct client *c) return (NULL); if (pid != getpid()) return (NULL); - log_debug("client %p TMUX %s (session @%u)", c, envent->value, session); - return (session_find_by_id(session)); + log_debug("%s: client %p TMUX %s (session $%u)", __func__, c, + envent->value, session); + + s = session_find_by_id(session); + if (s != NULL) + log_debug("%s: session $%u still exists", __func__, s->id); + return (s); } /* Find pane containing client if any. */ @@ -108,6 +114,8 @@ cmd_find_inside_pane(struct client *c) if (strcmp(wp->tty, c->ttyname) == 0) break; } + if (wp != NULL) + log_debug("%s: got pane %%%u (%s)", __func__, wp->id, wp->tty); return (wp); } @@ -166,6 +174,8 @@ cmd_find_best_session(struct session **slist, u_int ssize, int flags) struct session *s_loop, *s; u_int i; + log_debug("%s: %u sessions to try", __func__, ssize); + s = NULL; if (slist != NULL) { for (i = 0; i < ssize; i++) { @@ -189,6 +199,8 @@ cmd_find_best_session_with_window(struct cmd_find_state *fs) u_int ssize; struct session *s; + log_debug("%s: window is @%u", __func__, fs->w->id); + ssize = 0; RB_FOREACH(s, sessions, &sessions) { if (!session_has(s, fs->w)) @@ -218,6 +230,8 @@ cmd_find_best_winlink_with_window(struct cmd_find_state *fs) { struct winlink *wl, *wl_loop; + log_debug("%s: window is @%u", __func__, fs->w->id); + wl = NULL; if (fs->s->curw != NULL && fs->s->curw->window == fs->w) wl = fs->s->curw; @@ -705,7 +719,7 @@ void cmd_find_log_state(const char *prefix, struct cmd_find_state *fs) { if (fs->s != NULL) - log_debug("%s: s=$%u", prefix, fs->s->id); + log_debug("%s: s=$%u %s", prefix, fs->s->id, fs->s->name); else log_debug("%s: s=none", prefix); if (fs->wl != NULL) { @@ -894,6 +908,9 @@ cmd_find_from_client(struct cmd_find_state *fs, struct client *c, int flags) break; } if (wl != NULL) { + log_debug("%s: session $%u has pane %%%u", __func__, + s->id, wp->id); + fs->s = s; fs->wl = s->curw; /* use current session */ fs->w = fs->wl->window; diff --git a/session.c b/session.c index 5b17f085..95cbe3e6 100644 --- a/session.c +++ b/session.c @@ -290,9 +290,10 @@ session_update_activity(struct session *s, struct timeval *from) else memcpy(&s->activity_time, from, sizeof s->activity_time); - log_debug("session %s activity %lld.%06d (last %lld.%06d)", s->name, - (long long)s->activity_time.tv_sec, (int)s->activity_time.tv_usec, - (long long)last->tv_sec, (int)last->tv_usec); + log_debug("session $%u %s activity %lld.%06d (last %lld.%06d)", s->id, + s->name, (long long)s->activity_time.tv_sec, + (int)s->activity_time.tv_usec, (long long)last->tv_sec, + (int)last->tv_usec); if (evtimer_initialized(&s->lock_timer)) evtimer_del(&s->lock_timer);