diff options
author | Tiago Cunha <tcunha@gmx.com> | 2011-02-15 15:10:47 +0000 |
---|---|---|
committer | Tiago Cunha <tcunha@gmx.com> | 2011-02-15 15:10:47 +0000 |
commit | 2ab568fa88cb40e0d63696d60b9e871a9909074d (patch) | |
tree | bd016837745d00bb22bb54ec8156721c181acabf /screen-write.c | |
parent | 4e4568cade9c54f02b0f41d9372f4124f1fb54be (diff) |
Sync OpenBSD patchset 853:
When clearing the entire screen, clear lines that are used into the
history like xterm does. Requested ages ago by someone I've forgotten.
Diffstat (limited to 'screen-write.c')
-rw-r--r-- | screen-write.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/screen-write.c b/screen-write.c index beb58db8..99ff97bc 100644 --- a/screen-write.c +++ b/screen-write.c @@ -1,4 +1,4 @@ -/* $Id: screen-write.c,v 1.92 2011-01-07 14:34:45 tcunha Exp $ */ +/* $Id: screen-write.c,v 1.93 2011-02-15 15:10:47 tcunha Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -931,9 +931,14 @@ screen_write_clearendofscreen(struct screen_write_ctx *ctx) sx = screen_size_x(s); sy = screen_size_y(s); - if (s->cx <= sx - 1) - grid_view_clear(s->grid, s->cx, s->cy, sx - s->cx, 1); - grid_view_clear(s->grid, 0, s->cy + 1, sx, sy - (s->cy + 1)); + /* Scroll into history if it is enabled and clearing entire screen. */ + if (s->cy == 0 && s->grid->flags & GRID_HISTORY) + grid_view_clear_history(s->grid); + else { + if (s->cx <= sx - 1) + grid_view_clear(s->grid, s->cx, s->cy, sx - s->cx, 1); + grid_view_clear(s->grid, 0, s->cy + 1, sx, sy - (s->cy + 1)); + } tty_write(tty_cmd_clearendofscreen, &ttyctx); } @@ -969,7 +974,13 @@ screen_write_clearscreen(struct screen_write_ctx *ctx) screen_write_initctx(ctx, &ttyctx, 0); - grid_view_clear(s->grid, 0, 0, screen_size_x(s), screen_size_y(s)); + /* Scroll into history if it is enabled. */ + if (s->grid->flags & GRID_HISTORY) + grid_view_clear_history(s->grid); + else { + grid_view_clear( + s->grid, 0, 0, screen_size_x(s), screen_size_y(s)); + } tty_write(tty_cmd_clearscreen, &ttyctx); } |