=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/server-client.c,v retrieving revision 1.234 retrieving revision 1.235 diff -c -r1.234 -r1.235 *** src/usr.bin/tmux/server-client.c 2017/05/29 20:41:29 1.234 --- src/usr.bin/tmux/server-client.c 2017/05/31 10:15:51 1.235 *************** *** 1,4 **** ! /* $OpenBSD: server-client.c,v 1.234 2017/05/29 20:41:29 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott --- 1,4 ---- ! /* $OpenBSD: server-client.c,v 1.235 2017/05/31 10:15:51 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott *************** *** 1050,1063 **** if (!(wp->flags & PANE_RESIZE)) return; memset(&ws, 0, sizeof ws); ws.ws_col = wp->sx; ws.ws_row = wp->sy; - if (ioctl(wp->fd, TIOCSWINSZ, &ws) == -1) fatal("ioctl failed"); wp->flags &= ~PANE_RESIZE; } /* Check if pane should be resized. */ --- 1050,1085 ---- if (!(wp->flags & PANE_RESIZE)) return; + /* + * If we are resizing to the same size as when we entered the loop + * (that is, to the same size the application currently thinks it is), + * tmux may have gone through several resizes internally and thrown + * away parts of the screen. So we need the application to actually + * redraw even though its final size has not changed. + */ + if (wp->sx == wp->osx && + wp->sy == wp->osy && + wp->sx > 1 && + wp->sy > 1) { + memset(&ws, 0, sizeof ws); + ws.ws_col = wp->sx - 1; + ws.ws_row = wp->sy - 1; + if (ioctl(wp->fd, TIOCSWINSZ, &ws) == -1) + fatal("ioctl failed"); + log_debug("%s: %%%u forcing resize", __func__, wp->id); + } + memset(&ws, 0, sizeof ws); ws.ws_col = wp->sx; ws.ws_row = wp->sy; if (ioctl(wp->fd, TIOCSWINSZ, &ws) == -1) fatal("ioctl failed"); + log_debug("%s: %%%u resize to %u,%u", __func__, wp->id, wp->sx, wp->sy); wp->flags &= ~PANE_RESIZE; + + wp->osx = wp->sx; + wp->osy = wp->sy; } /* Check if pane should be resized. */ *************** *** 1068,1073 **** --- 1090,1096 ---- if (!(wp->flags & PANE_RESIZE)) return; + log_debug("%s: %%%u resize to %u,%u", __func__, wp->id, wp->sx, wp->sy); if (!event_initialized(&wp->resize_timer)) evtimer_set(&wp->resize_timer, server_client_resize_event, wp);