1
0
mirror of https://github.com/tmux/tmux.git synced 2025-04-24 13:28:49 +00:00

Merge branch 'obsd-master'

This commit is contained in:
Thomas Adam 2015-10-22 14:01:12 +01:00
commit 8c39813665
4 changed files with 39 additions and 16 deletions

View File

@ -254,24 +254,35 @@ cmd_find_current_session_with_client(struct cmd_find_state *fs)
wp = NULL; wp = NULL;
/* Not running in a pane. We know nothing. Find the best session. */ /* Not running in a pane. We know nothing. Find the best session. */
if (wp == NULL) { if (wp == NULL)
fs->s = cmd_find_best_session(NULL, 0, fs->flags); goto unknown_pane;
if (fs->s == NULL)
return (-1);
fs->wl = fs->s->curw;
fs->idx = fs->wl->idx;
fs->w = fs->wl->window;
fs->wp = fs->w->active;
return (0);
}
/* We now know the window and pane. */ /* We now know the window and pane. */
fs->w = wp->window; fs->w = wp->window;
fs->wp = wp; fs->wp = wp;
/* Find the best session and winlink. */ /* Find the best session and winlink. */
if (cmd_find_best_session_with_window(fs) != 0) if (cmd_find_best_session_with_window(fs) != 0) {
if (wp != NULL) {
/*
* The window may have been destroyed but the pane
* still on all_window_panes due to something else
* holding a reference.
*/
goto unknown_pane;
}
return (-1); return (-1);
}
return (0);
unknown_pane:
fs->s = cmd_find_best_session(NULL, 0, fs->flags);
if (fs->s == NULL)
return (-1);
fs->wl = fs->s->curw;
fs->idx = fs->wl->idx;
fs->w = fs->wl->window;
fs->wp = fs->w->active;
return (0); return (0);
} }

View File

@ -120,14 +120,19 @@ cmd_select_pane_exec(struct cmd *self, struct cmd_q *cmdq)
return (CMD_RETURN_NORMAL); return (CMD_RETURN_NORMAL);
} }
if (args_has(self->args, 'L')) if (args_has(self->args, 'L')) {
server_unzoom_window(wp->window);
wp = window_pane_find_left(wp); wp = window_pane_find_left(wp);
else if (args_has(self->args, 'R')) } else if (args_has(self->args, 'R')) {
server_unzoom_window(wp->window);
wp = window_pane_find_right(wp); wp = window_pane_find_right(wp);
else if (args_has(self->args, 'U')) } else if (args_has(self->args, 'U')) {
server_unzoom_window(wp->window);
wp = window_pane_find_up(wp); wp = window_pane_find_up(wp);
else if (args_has(self->args, 'D')) } else if (args_has(self->args, 'D')) {
server_unzoom_window(wp->window);
wp = window_pane_find_down(wp); wp = window_pane_find_down(wp);
}
if (wp == NULL) if (wp == NULL)
return (CMD_RETURN_NORMAL); return (CMD_RETURN_NORMAL);

View File

@ -1164,38 +1164,45 @@ server_client_msg_identify(struct client *c, struct imsg *imsg)
fatalx("bad MSG_IDENTIFY_FLAGS size"); fatalx("bad MSG_IDENTIFY_FLAGS size");
memcpy(&flags, data, sizeof flags); memcpy(&flags, data, sizeof flags);
c->flags |= flags; c->flags |= flags;
log_debug("client %p IDENTIFY_FLAGS %#x", c, flags);
break; break;
case MSG_IDENTIFY_TERM: case MSG_IDENTIFY_TERM:
if (datalen == 0 || data[datalen - 1] != '\0') if (datalen == 0 || data[datalen - 1] != '\0')
fatalx("bad MSG_IDENTIFY_TERM string"); fatalx("bad MSG_IDENTIFY_TERM string");
c->term = xstrdup(data); c->term = xstrdup(data);
log_debug("client %p IDENTIFY_TERM %s", c, data);
break; break;
case MSG_IDENTIFY_TTYNAME: case MSG_IDENTIFY_TTYNAME:
if (datalen == 0 || data[datalen - 1] != '\0') if (datalen == 0 || data[datalen - 1] != '\0')
fatalx("bad MSG_IDENTIFY_TTYNAME string"); fatalx("bad MSG_IDENTIFY_TTYNAME string");
c->ttyname = xstrdup(data); c->ttyname = xstrdup(data);
log_debug("client %p IDENTIFY_TTYNAME %s", c, data);
break; break;
case MSG_IDENTIFY_CWD: case MSG_IDENTIFY_CWD:
if (datalen == 0 || data[datalen - 1] != '\0') if (datalen == 0 || data[datalen - 1] != '\0')
fatalx("bad MSG_IDENTIFY_CWD string"); fatalx("bad MSG_IDENTIFY_CWD string");
if ((c->cwd = open(data, O_RDONLY)) == -1) if ((c->cwd = open(data, O_RDONLY)) == -1)
c->cwd = open("/", O_RDONLY); c->cwd = open("/", O_RDONLY);
log_debug("client %p IDENTIFY_CWD %s", c, data);
break; break;
case MSG_IDENTIFY_STDIN: case MSG_IDENTIFY_STDIN:
if (datalen != 0) if (datalen != 0)
fatalx("bad MSG_IDENTIFY_STDIN size"); fatalx("bad MSG_IDENTIFY_STDIN size");
c->fd = imsg->fd; c->fd = imsg->fd;
log_debug("client %p IDENTIFY_STDIN %d", c, imsg->fd);
break; break;
case MSG_IDENTIFY_ENVIRON: case MSG_IDENTIFY_ENVIRON:
if (datalen == 0 || data[datalen - 1] != '\0') if (datalen == 0 || data[datalen - 1] != '\0')
fatalx("bad MSG_IDENTIFY_ENVIRON string"); fatalx("bad MSG_IDENTIFY_ENVIRON string");
if (strchr(data, '=') != NULL) if (strchr(data, '=') != NULL)
environ_put(&c->environ, data); environ_put(&c->environ, data);
log_debug("client %p IDENTIFY_ENVIRON %s", c, data);
break; break;
case MSG_IDENTIFY_CLIENTPID: case MSG_IDENTIFY_CLIENTPID:
if (datalen != sizeof c->pid) if (datalen != sizeof c->pid)
fatalx("bad MSG_IDENTIFY_CLIENTPID size"); fatalx("bad MSG_IDENTIFY_CLIENTPID size");
memcpy(&c->pid, data, sizeof c->pid); memcpy(&c->pid, data, sizeof c->pid);
log_debug("client %p IDENTIFY_CLIENTPID %ld", c, (long)c->pid);
break; break;
default: default:
break; break;

View File

@ -282,7 +282,7 @@ server_send_exit(void)
if (c->flags & (CLIENT_BAD|CLIENT_SUSPENDED)) if (c->flags & (CLIENT_BAD|CLIENT_SUSPENDED))
server_client_lost(c); server_client_lost(c);
else else
server_write_client(c, MSG_EXIT, NULL, 0); server_write_client(c, MSG_SHUTDOWN, NULL, 0);
c->session = NULL; c->session = NULL;
} }