=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/resize.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- src/usr.bin/tmux/resize.c 2009/06/01 22:58:49 1.1 +++ src/usr.bin/tmux/resize.c 2009/07/14 07:23:36 1.2 @@ -1,4 +1,4 @@ -/* $OpenBSD: resize.c,v 1.1 2009/06/01 22:58:49 nicm Exp $ */ +/* $OpenBSD: resize.c,v 1.2 2009/07/14 07:23:36 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -48,6 +48,7 @@ struct session *s; struct client *c; struct window *w; + struct window_pane *wp; u_int i, j, ssx, ssy, has, limit; int flag; @@ -132,6 +133,20 @@ "window size %u,%u (was %u,%u)", ssx, ssy, w->sx, w->sy); window_resize(w, ssx, ssy); + + /* + * If the current pane is now not visible, move to the next + * that is. + */ + wp = w->active; + 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) + break; + } + server_redraw_window(w); layout_refresh(w, 0); }