aboutsummaryrefslogtreecommitdiff
path: root/screen.c
diff options
context:
space:
mode:
Diffstat (limited to 'screen.c')
-rw-r--r--screen.c26
1 files changed, 20 insertions, 6 deletions
diff --git a/screen.c b/screen.c
index 16c3b5ea..f1a723a3 100644
--- a/screen.c
+++ b/screen.c
@@ -174,10 +174,20 @@ screen_resize_y(struct screen *s, u_int sy)
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 @@ screen_resize_y(struct screen *s, u_int sy)
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. */