From ebe07c27260c295256e7c66480057a3fcfdc9e7f Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Wed, 3 Jun 2009 23:26:56 +0000 Subject: [PATCH] Fix some miscalculations when clearing to start of screen: the number of lines to the cursor is cy not cy - 1, and the current cursor cell should be included. --- screen-write.c | 4 ++-- tty.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/screen-write.c b/screen-write.c index b57b0620..033a1a52 100644 --- a/screen-write.c +++ b/screen-write.c @@ -605,11 +605,11 @@ screen_write_clearstartofscreen(struct screen_write_ctx *ctx) sx = screen_size_x(s); if (s->cy > 0) - grid_view_clear(s->grid, 0, 0, sx, s->cy - 1); + grid_view_clear(s->grid, 0, 0, sx, s->cy); if (s->cx > sx - 1) grid_view_clear(s->grid, 0, s->cy, sx, 1); else - grid_view_clear(s->grid, 0, s->cy, s->cx, 1); + grid_view_clear(s->grid, 0, s->cy, s->cx + 1, 1); tty_write_cmd(ctx->wp, TTY_CLEARSTARTOFSCREEN); } diff --git a/tty.c b/tty.c index 06ce9248..16a865eb 100644 --- a/tty.c +++ b/tty.c @@ -797,7 +797,7 @@ tty_cmd_clearstartofscreen( tty_putc(tty, ' '); } } - for (i = 0; i < s->old_cx; i++) + for (i = 0; i <= s->old_cx; i++) tty_putc(tty, ' '); }