summaryrefslogtreecommitdiffstats
path: root/cmd-find.c
diff options
context:
space:
mode:
authorThomas Adam <thomas@xteddy.org>2018-05-04 11:02:31 +0100
committerThomas Adam <thomas@xteddy.org>2018-05-04 11:02:31 +0100
commit91b220525b0406763dafb6698d2741bec580bc10 (patch)
treeae7d3afcd6dc948f7bae8adc8abe040c967a6318 /cmd-find.c
parent1d858aa89eecae2a4aa6021650216ca9fce8ba25 (diff)
parent988c6bc433afe23b3883a0be54b8efa9d7d744f6 (diff)
Merge branch 'obsd-master'
Diffstat (limited to 'cmd-find.c')
-rw-r--r--cmd-find.c23
1 files changed, 20 insertions, 3 deletions
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;