summaryrefslogtreecommitdiffstats
path: root/grid-view.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2009-07-09 07:58:14 +0000
committerNicholas Marriott <nicm@openbsd.org>2009-07-09 07:58:14 +0000
commit86c93c6e34cfe927e8d4e2901febf2ee063fa88b (patch)
treeb0325e3ce67cb7c67c4cbf97e09fc72d2ddc490d /grid-view.c
parent643c219d180be584092f406c52602fb7f84c8852 (diff)
Change inserting and deleting lines inside the scroll region to properly clear
lines that should be inserted/deleted but not moved. Fixes problems with mutt reported by Brian Lewis, thanks.
Diffstat (limited to 'grid-view.c')
-rw-r--r--grid-view.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/grid-view.c b/grid-view.c
index a9144a1f..5ad8fc2f 100644
--- a/grid-view.c
+++ b/grid-view.c
@@ -134,13 +134,17 @@ grid_view_insert_lines(struct grid *gd, u_int py, u_int ny)
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 @@ 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));
+ 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. */