From 7cc470664616e7acbaaec65da760fd905e8e652d Mon Sep 17 00:00:00 2001 From: nicm Date: Wed, 12 Nov 2014 22:59:45 +0000 Subject: [PATCH] Restore change in r1.17 but add checks to prevent the line length overflowing, from Balazs Kezes. --- grid-view.c | 8 ++++++-- 1 file 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);