diff options
Diffstat (limited to 'window.c')
-rw-r--r-- | window.c | 22 |
1 files changed, 20 insertions, 2 deletions
@@ -1,4 +1,4 @@ -/* $Id: window.c,v 1.90 2009-07-14 06:40:33 nicm Exp $ */ +/* $Id: window.c,v 1.91 2009-07-15 17:42:44 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -289,8 +289,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 * @@ -605,6 +611,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) { |