=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/window.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- src/usr.bin/tmux/window.c 2009/07/13 10:43:52 1.9 +++ src/usr.bin/tmux/window.c 2009/07/14 07:23:36 1.10 @@ -1,4 +1,4 @@ -/* $OpenBSD: window.c,v 1.9 2009/07/13 10:43:52 nicm Exp $ */ +/* $OpenBSD: window.c,v 1.10 2009/07/14 07:23:36 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -291,8 +291,14 @@ 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 @@ wp->mode->mouse(wp, c, b, x, y); } else 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 *