mirror of
https://github.com/tmux/tmux.git
synced 2025-01-12 03:08:46 +00:00
Merge branch 'obsd-master'
This commit is contained in:
commit
21240c1a8f
34
cmd-find.c
34
cmd-find.c
@ -748,8 +748,10 @@ cmd_find_from_session_window(struct cmd_find_state *fs, struct session *s,
|
||||
|
||||
fs->s = s;
|
||||
fs->w = w;
|
||||
if (cmd_find_best_winlink_with_window(fs) != 0)
|
||||
if (cmd_find_best_winlink_with_window(fs) != 0) {
|
||||
cmd_find_clear_state(fs, 0);
|
||||
return (-1);
|
||||
}
|
||||
fs->wp = fs->w->active;
|
||||
|
||||
cmd_find_log_state(__func__, fs);
|
||||
@ -763,10 +765,14 @@ cmd_find_from_window(struct cmd_find_state *fs, struct window *w)
|
||||
cmd_find_clear_state(fs, 0);
|
||||
|
||||
fs->w = w;
|
||||
if (cmd_find_best_session_with_window(fs) != 0)
|
||||
if (cmd_find_best_session_with_window(fs) != 0) {
|
||||
cmd_find_clear_state(fs, 0);
|
||||
return (-1);
|
||||
if (cmd_find_best_winlink_with_window(fs) != 0)
|
||||
}
|
||||
if (cmd_find_best_winlink_with_window(fs) != 0) {
|
||||
cmd_find_clear_state(fs, 0);
|
||||
return (-1);
|
||||
}
|
||||
fs->wp = fs->w->active;
|
||||
|
||||
cmd_find_log_state(__func__, fs);
|
||||
@ -795,8 +801,10 @@ cmd_find_from_pane(struct cmd_find_state *fs, struct window_pane *wp)
|
||||
{
|
||||
if (cmd_find_from_window(fs, wp->window) != 0)
|
||||
return (-1);
|
||||
if (window_pane_outside(wp))
|
||||
if (window_pane_outside(wp)) {
|
||||
cmd_find_clear_state(fs, 0);
|
||||
return (-1);
|
||||
}
|
||||
fs->wp = wp;
|
||||
|
||||
cmd_find_log_state(__func__, fs);
|
||||
@ -810,8 +818,10 @@ cmd_find_from_nothing(struct cmd_find_state *fs)
|
||||
cmd_find_clear_state(fs, 0);
|
||||
|
||||
fs->s = cmd_find_best_session(NULL, 0, fs->flags);
|
||||
if (fs->s == NULL)
|
||||
if (fs->s == NULL) {
|
||||
cmd_find_clear_state(fs, 0);
|
||||
return (-1);
|
||||
}
|
||||
fs->wl = fs->s->curw;
|
||||
fs->idx = fs->wl->idx;
|
||||
fs->w = fs->wl->window;
|
||||
@ -831,8 +841,10 @@ cmd_find_from_mouse(struct cmd_find_state *fs, struct mouse_event *m)
|
||||
return (-1);
|
||||
|
||||
fs->wp = cmd_mouse_pane(m, &fs->s, &fs->wl);
|
||||
if (fs->wp == NULL)
|
||||
if (fs->wp == NULL) {
|
||||
cmd_find_clear_state(fs, 0);
|
||||
return (-1);
|
||||
}
|
||||
fs->w = fs->wl->window;
|
||||
|
||||
cmd_find_log_state(__func__, fs);
|
||||
@ -901,6 +913,7 @@ cmd_find_from_client(struct cmd_find_state *fs, struct client *c)
|
||||
*/
|
||||
goto unknown_pane;
|
||||
}
|
||||
cmd_find_clear_state(fs, 0);
|
||||
return (-1);
|
||||
}
|
||||
fs->wl = fs->s->curw;
|
||||
@ -960,9 +973,8 @@ cmd_find_target(struct cmd_find_state *fs, struct cmdq_item *item,
|
||||
fs->current = ¤t;
|
||||
log_debug("%s: current is from client", __func__);
|
||||
} else
|
||||
return (-1);
|
||||
if (!cmd_find_empty_state(fs->current) &&
|
||||
!cmd_find_valid_state(fs->current))
|
||||
goto error;
|
||||
if (!cmd_find_valid_state(fs->current))
|
||||
fatalx("invalid current find state");
|
||||
|
||||
/* An empty or NULL target is the current. */
|
||||
@ -1082,8 +1094,8 @@ cmd_find_target(struct cmd_find_state *fs, struct cmdq_item *item,
|
||||
if (pane != NULL)
|
||||
pane = cmd_find_map_table(cmd_find_pane_table, pane);
|
||||
|
||||
log_debug("target %s (flags %#x): session=%s, window=%s, pane=%s",
|
||||
target, flags, session == NULL ? "none" : session,
|
||||
log_debug("%s: target %s (flags %#x): session=%s, window=%s, pane=%s",
|
||||
__func__, target, flags, session == NULL ? "none" : session,
|
||||
window == NULL ? "none" : window, pane == NULL ? "none" : pane);
|
||||
|
||||
/* No pane is allowed if want an index. */
|
||||
|
@ -203,14 +203,14 @@ cmdq_fire_command(struct cmdq_item *item)
|
||||
flags = !!(cmd->flags & CMD_CONTROL);
|
||||
cmdq_guard(item, "begin", flags);
|
||||
|
||||
if (item->client == NULL)
|
||||
item->client = cmd_find_client(item, NULL, 1);
|
||||
|
||||
if (cmd_prepare_state(cmd, item) != 0) {
|
||||
retval = CMD_RETURN_ERROR;
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (item->client == NULL)
|
||||
item->client = cmd_find_client(item, NULL, 1);
|
||||
|
||||
retval = cmd->entry->exec(cmd, item);
|
||||
if (retval == CMD_RETURN_ERROR)
|
||||
goto out;
|
||||
|
@ -63,24 +63,24 @@ cmd_select_pane_exec(struct cmd *self, struct cmdq_item *item)
|
||||
const char *style;
|
||||
|
||||
if (self->entry == &cmd_last_pane_entry || args_has(args, 'l')) {
|
||||
if (wl->window->last == NULL) {
|
||||
lastwp = w->last;
|
||||
if (lastwp == NULL) {
|
||||
cmdq_error(item, "no last pane");
|
||||
return (CMD_RETURN_ERROR);
|
||||
}
|
||||
|
||||
if (args_has(self->args, 'e'))
|
||||
w->last->flags &= ~PANE_INPUTOFF;
|
||||
lastwp->flags &= ~PANE_INPUTOFF;
|
||||
else if (args_has(self->args, 'd'))
|
||||
w->last->flags |= PANE_INPUTOFF;
|
||||
lastwp->flags |= PANE_INPUTOFF;
|
||||
else {
|
||||
server_unzoom_window(w);
|
||||
window_redraw_active_switch(w, w->last);
|
||||
if (window_set_active_pane(w, w->last)) {
|
||||
window_redraw_active_switch(w, lastwp);
|
||||
if (window_set_active_pane(w, lastwp)) {
|
||||
server_status_window(w);
|
||||
server_redraw_window_borders(w);
|
||||
}
|
||||
}
|
||||
|
||||
return (CMD_RETURN_NORMAL);
|
||||
}
|
||||
|
||||
|
@ -948,9 +948,6 @@ retry:
|
||||
if (KEYC_IS_MOUSE(key) && m->valid && wp != NULL) {
|
||||
cmd_find_from_winlink_pane(&fs, s->curw, wp);
|
||||
cmd_find_log_state(__func__, &fs);
|
||||
|
||||
if (!cmd_find_valid_state(&fs))
|
||||
fatalx("invalid key state");
|
||||
key_bindings_dispatch(bd, c, m, &fs);
|
||||
} else
|
||||
key_bindings_dispatch(bd, c, m, NULL);
|
||||
|
Loading…
Reference in New Issue
Block a user