-/* $OpenBSD: cmd-find.c,v 1.48 2017/04/21 20:26:34 nicm Exp $ */
+/* $OpenBSD: cmd-find.c,v 1.49 2017/04/21 22:00:06 nicm Exp $ */
/*
* Copyright (c) 2015 Nicholas Marriott <nicholas.marriott@gmail.com>
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);
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);
{
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);
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;
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);
*/
goto unknown_pane;
}
+ cmd_find_clear_state(fs, 0);
return (-1);
}
fs->wl = fs->s->curw;
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. */