=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/screen.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- src/usr.bin/tmux/screen.c 2009/07/09 22:48:20 1.7 +++ src/usr.bin/tmux/screen.c 2009/07/13 10:43:52 1.8 @@ -1,4 +1,4 @@ -/* $OpenBSD: screen.c,v 1.7 2009/07/09 22:48:20 nicm Exp $ */ +/* $OpenBSD: screen.c,v 1.8 2009/07/13 10:43:52 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -174,10 +174,20 @@ needed -= available; /* - * Now just increase the history size to take over the lines - * which are left. XXX Should apply history limit? + * Now just increase the history size, if possible, to take + * over the lines which are left. If history is off, delete + * lines from the top. + * + * XXX Should apply history limit? */ - gd->hsize += needed; + available = s->cy; + if (gd->flags & GRID_HISTORY) + gd->hsize += needed; + else if (available > 0) { + if (available > needed) + available = needed; + grid_view_delete_lines(gd, 0, available); + } s->cy -= needed; } @@ -191,14 +201,18 @@ if (sy > oldy) { needed = sy - oldy; - /* Try to pull as much as possible out of the history. */ + /* + * Try to pull as much as possible out of the history, if is + * is enabled. + */ available = gd->hsize; - if (available > 0) { + if (gd->flags & GRID_HISTORY && available > 0) { if (available > needed) available = needed; gd->hsize -= available; s->cy += available; - } + } else + available = 0; needed -= available; /* Then fill the rest in with blanks. */