summaryrefslogtreecommitdiffstats
path: root/grid-view.c
diff options
context:
space:
mode:
authornicm <nicm>2014-11-12 22:59:45 +0000
committernicm <nicm>2014-11-12 22:59:45 +0000
commit7cc470664616e7acbaaec65da760fd905e8e652d (patch)
treea473c9eac2ac5bc50426fc1b8203594aaba2402c /grid-view.c
parentd37f266524803de945af25c4e9fff8209e927374 (diff)
Restore change in r1.17 but add checks to prevent the line length
overflowing, from Balazs Kezes.
Diffstat (limited to 'grid-view.c')
-rw-r--r--grid-view.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/grid-view.c b/grid-view.c
index badabd56..a34c5a08 100644
--- a/grid-view.c
+++ b/grid-view.c
@@ -184,7 +184,9 @@ grid_view_insert_cells(struct grid *gd, u_int px, u_int py, u_int nx)
px = grid_view_x(gd, px);
py = grid_view_y(gd, py);
- sx = grid_view_x(gd, gd->sx);
+ sx = grid_view_x(gd, gd->linedata[py].cellsize);
+ if (sx < px + nx)
+ sx = px + nx;
if (px == sx - 1)
grid_clear(gd, px, py, 1, 1);
@@ -201,7 +203,9 @@ grid_view_delete_cells(struct grid *gd, u_int px, u_int py, u_int nx)
px = grid_view_x(gd, px);
py = grid_view_y(gd, py);
- sx = grid_view_x(gd, gd->sx);
+ sx = grid_view_x(gd, gd->linedata[py].cellsize);
+ if (sx < px + nx)
+ sx = px + nx;
grid_move_cells(gd, px, px + nx, py, sx - px - nx);
grid_clear(gd, sx - nx, py, px + nx - (sx - nx), 1);