aboutsummaryrefslogtreecommitdiff
path: root/window.c
diff options
context:
space:
mode:
Diffstat (limited to 'window.c')
-rw-r--r--window.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/window.c b/window.c
index 753f796a..3dfe89ec 100644
--- a/window.c
+++ b/window.c
@@ -291,8 +291,14 @@ void
window_set_active_pane(struct window *w, struct window_pane *wp)
{
w->active = wp;
- while (w->active->flags & PANE_HIDDEN)
+
+ while (!window_pane_visible(w->active)) {
w->active = TAILQ_PREV(w->active, window_panes, entry);
+ if (w->active == NULL)
+ w->active = TAILQ_LAST(&w->panes, window_panes);
+ if (w->active == wp)
+ return;
+ }
}
struct window_pane *
@@ -607,6 +613,18 @@ window_pane_mouse(
input_mouse(wp, b, x, y);
}
+int
+window_pane_visible(struct window_pane *wp)
+{
+ struct window *w = wp->window;
+
+ if (wp->xoff >= w->sx || wp->yoff >= w->sy)
+ return (0);
+ if (wp->xoff + wp->sx > w->sx || wp->yoff + wp->sy > w->sy)
+ return (0);
+ return (1);
+}
+
char *
window_pane_search(struct window_pane *wp, const char *searchstr, u_int *lineno)
{