=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/screen.c,v retrieving revision 1.39 retrieving revision 1.40 diff -c -r1.39 -r1.40 *** src/usr.bin/tmux/screen.c 2016/07/15 00:49:08 1.39 --- src/usr.bin/tmux/screen.c 2016/09/02 20:57:20 1.40 *************** *** 1,4 **** ! /* $OpenBSD: screen.c,v 1.39 2016/07/15 00:49:08 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott --- 1,4 ---- ! /* $OpenBSD: screen.c,v 1.40 2016/09/02 20:57:20 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott *************** *** 177,184 **** * If the height is decreasing, delete lines from the bottom until * hitting the cursor, then push lines from the top into the history. * ! * When increasing, pull as many lines as possible from the history to ! * the top, then fill the remaining with blanks at the bottom. */ /* Size decreasing. */ --- 177,185 ---- * If the height is decreasing, delete lines from the bottom until * hitting the cursor, then push lines from the top into the history. * ! * When increasing, pull as many lines as possible from scrolled ! * history (not explicitly cleared from view) to the top, then fill the ! * remaining with blanks at the bottom. */ /* Size decreasing. */ *************** *** 200,208 **** * lines from the top. */ available = s->cy; ! if (gd->flags & GRID_HISTORY) gd->hsize += needed; ! else if (needed > 0 && available > 0) { if (available > needed) available = needed; grid_view_delete_lines(gd, 0, available); --- 201,210 ---- * lines from the top. */ available = s->cy; ! if (gd->flags & GRID_HISTORY) { ! gd->hscrolled += needed; gd->hsize += needed; ! } else if (needed > 0 && available > 0) { if (available > needed) available = needed; grid_view_delete_lines(gd, 0, available); *************** *** 219,231 **** needed = sy - oldy; /* ! * Try to pull as much as possible out of the history, if is * is enabled. */ ! available = gd->hsize; if (gd->flags & GRID_HISTORY && available > 0) { if (available > needed) available = needed; gd->hsize -= available; s->cy += available; } else --- 221,234 ---- needed = sy - oldy; /* ! * Try to pull as much as possible out of scrolled history, if is * is enabled. */ ! available = gd->hscrolled; if (gd->flags & GRID_HISTORY && available > 0) { if (available > needed) available = needed; + gd->hscrolled -= available; gd->hsize -= available; s->cy += available; } else