diff --git a/grid-view.c b/grid-view.c index 75dc686a..aa83da13 100644 --- a/grid-view.c +++ b/grid-view.c @@ -158,6 +158,7 @@ grid_view_delete_lines(struct grid *gd, u_int py, u_int ny) sy = grid_view_y(gd, gd->sy); grid_move_lines(gd, py, py + ny, sy - py - ny); + grid_clear(gd, 0, sy - ny, gd->sx, py + ny - (sy - ny)); } /* Delete lines inside scroll region. */ @@ -191,7 +192,7 @@ grid_view_insert_cells(struct grid *gd, u_int px, u_int py, u_int nx) if (px == sx - 1) grid_clear(gd, px, py, 1, 1); else - grid_move_cells(gd, px + nx, px, py, (sx - 1) - (px + nx)); + grid_move_cells(gd, px + nx, px, py, sx - px - nx); } /* Delete characters. */ @@ -207,7 +208,8 @@ grid_view_delete_cells(struct grid *gd, u_int px, u_int py, u_int nx) sx = grid_view_x(gd, gd->sx); - grid_move_cells(gd, px, px + nx, py, (sx - 1) - (px + nx)); + grid_move_cells(gd, px, px + nx, py, sx - px - nx); + grid_clear(gd, sx - nx, py, px + nx - (sx - nx), 1); } /* Convert cells into a string. */ diff --git a/screen-write.c b/screen-write.c index e3a215ac..d0049c63 100644 --- a/screen-write.c +++ b/screen-write.c @@ -325,8 +325,8 @@ screen_write_insertcharacter(struct screen_write_ctx *ctx, u_int nx) if (nx == 0) nx = 1; - if (nx > screen_size_x(s) - 1 - s->cx) - nx = screen_size_x(s) - 1 - s->cx; + if (nx > screen_size_x(s) - s->cx) + nx = screen_size_x(s) - s->cx; if (nx == 0) return; @@ -347,8 +347,8 @@ screen_write_deletecharacter(struct screen_write_ctx *ctx, u_int nx) if (nx == 0) nx = 1; - if (nx > screen_size_x(s) - 1 - s->cx) - nx = screen_size_x(s) - 1 - s->cx; + if (nx > screen_size_x(s) - s->cx) + nx = screen_size_x(s) - s->cx; if (nx == 0) return; @@ -369,8 +369,8 @@ screen_write_insertline(struct screen_write_ctx *ctx, u_int ny) if (ny == 0) ny = 1; - if (ny > screen_size_y(s) - 1 - s->cy) - ny = screen_size_y(s) - 1 - s->cy; + if (ny > screen_size_y(s) - s->cy) + ny = screen_size_y(s) - s->cy; if (ny == 0) return; @@ -395,8 +395,8 @@ screen_write_deleteline(struct screen_write_ctx *ctx, u_int ny) if (ny == 0) ny = 1; - if (ny > screen_size_y(s) - 1 - s->cy) - ny = screen_size_y(s) - 1 - s->cy; + if (ny > screen_size_y(s) - s->cy) + ny = screen_size_y(s) - s->cy; if (ny == 0) return;