aboutsummaryrefslogtreecommitdiff
path: root/grid-view.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicholas.marriott@gmail.com>2009-07-01 19:14:33 +0000
committerNicholas Marriott <nicholas.marriott@gmail.com>2009-07-01 19:14:33 +0000
commit35092835b04fda9ab5b13517701d0ee096abe1c0 (patch)
tree35bd57df43f8a804eae4a435b09cbf003a0101ce /grid-view.c
parent8fe3f1dcb20d06ed9d747834f97b91829dcbf6b6 (diff)
downloadrtmux-35092835b04fda9ab5b13517701d0ee096abe1c0.tar.gz
rtmux-35092835b04fda9ab5b13517701d0ee096abe1c0.tar.bz2
rtmux-35092835b04fda9ab5b13517701d0ee096abe1c0.zip
Fix two errors with character/line insertion and deletion: the maximum number
of characters which may be inserted or deleted is the screen width, not one less (and similarly for lines and height); and if characters or lines are deleted by moving the ones that follow, the space at the end needs to be cleared. This appears to solve long-standing redraw issues most visible when using the force-width option then scrolling in view(1) or unwrapping lines in emacs.
Diffstat (limited to 'grid-view.c')
-rw-r--r--grid-view.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/grid-view.c b/grid-view.c
index 2990bc56..5ea52bf5 100644
--- a/grid-view.c
+++ b/grid-view.c
@@ -1,4 +1,4 @@
-/* $Id $ */
+/* $Id: grid-view.c,v 1.15 2009-07-01 19:14:33 nicm Exp $ */
/*
* Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -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. */