=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/grid-view.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- src/usr.bin/tmux/grid-view.c 2009/07/09 00:29:32 1.4 +++ src/usr.bin/tmux/grid-view.c 2009/07/09 07:58:14 1.5 @@ -1,4 +1,4 @@ -/* $OpenBSD: grid-view.c,v 1.4 2009/07/09 00:29:32 nicm Exp $ */ +/* $OpenBSD: grid-view.c,v 1.5 2009/07/09 07:58:14 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott @@ -134,13 +134,17 @@ void grid_view_insert_lines_region(struct grid *gd, u_int rlower, u_int py, u_int ny) { + u_int ny2; + GRID_DEBUG(gd, "rlower=%u, py=%u, ny=%u", rlower, py, ny); rlower = grid_view_y(gd, rlower); py = grid_view_y(gd, py); - grid_move_lines(gd, py + ny, py, (rlower + 1) - py - ny); + ny2 = rlower + 1 - py - ny; + grid_move_lines(gd, rlower + 1 - ny2, py, ny2); + grid_clear(gd, 0, py + ny2, gd->sx, ny - ny2); } /* Delete lines. */ @@ -156,20 +160,24 @@ 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)); + grid_clear(gd, 0, sy - ny, gd->sx, py + ny - (sy - ny)); } /* Delete lines inside scroll region. */ void grid_view_delete_lines_region(struct grid *gd, u_int rlower, u_int py, u_int ny) { + u_int ny2; + GRID_DEBUG(gd, "rlower=%u, py=%u, ny=%u", rlower, py, ny); rlower = grid_view_y(gd, rlower); py = grid_view_y(gd, py); - grid_move_lines(gd, py, py + ny, (rlower + 1) - py - ny); + ny2 = rlower + 1 - py - ny; + grid_move_lines(gd, py, py + ny, ny2); + grid_clear(gd, 0, py + ny2, gd->sx, ny - ny2); } /* Insert characters. */