Merge branch 'obsd-master'

This commit is contained in:
Thomas Adam
2015-04-29 18:42:12 +01:00
6 changed files with 71 additions and 35 deletions

View File

@ -242,10 +242,13 @@ cmd_find_current_session_with_client(struct cmd_find_state *fs)
struct window_pane *wp;
/* If this is running in a pane, that's great. */
RB_FOREACH(wp, window_pane_tree, &all_window_panes) {
if (strcmp(wp->tty, fs->cmdq->client->tty.path) == 0)
break;
}
if (fs->cmdq->client->tty.path != NULL) {
RB_FOREACH(wp, window_pane_tree, &all_window_panes) {
if (strcmp(wp->tty, fs->cmdq->client->tty.path) == 0)
break;
}
} else
wp = NULL;
/* Not running in a pane. We know nothing. Find the best session. */
if (wp == NULL) {
@ -425,7 +428,20 @@ cmd_find_get_window(struct cmd_find_state *fs, const char *window)
fs->s = fs->current->s;
/* We now only need to find the winlink in this session. */
return (cmd_find_get_window_with_session(fs, window));
if (cmd_find_get_window_with_session(fs, window) == 0)
return (0);
/* Otherwise try as a session itself. */
if (cmd_find_get_session(fs, window) == 0) {
if (~fs->flags & CMD_FIND_WINDOW_INDEX) {
fs->wl = fs->s->curw;
fs->w = fs->wl->window;
fs->idx = fs->wl->idx;
}
return (0);
}
return (-1);
}
/*
@ -591,14 +607,23 @@ cmd_find_get_pane(struct cmd_find_state *fs, const char *pane)
return (cmd_find_best_session_with_window(fs));
}
/* Not a pane id, so use the current session and window. */
/* Not a pane id, so try the current session and window. */
fs->s = fs->current->s;
fs->wl = fs->current->wl;
fs->idx = fs->current->idx;
fs->w = fs->current->w;
/* We now only need to find the pane in this window. */
return (cmd_find_get_pane_with_window(fs, pane));
if (cmd_find_get_pane_with_window(fs, pane) == 0)
return (0);
/* Otherwise try as a window itself (this will also try as session). */
if (cmd_find_get_window(fs, pane) == 0) {
fs->wp = fs->w->active;
return (0);
}
return (-1);
}
/*