=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/grid.c,v retrieving revision 1.97 retrieving revision 1.98 diff -u -r1.97 -r1.98 --- src/usr.bin/tmux/grid.c 2019/07/06 20:37:29 1.97 +++ src/usr.bin/tmux/grid.c 2019/07/16 10:30:56 1.98 @@ -1,4 +1,4 @@ -/* $OpenBSD: grid.c,v 1.97 2019/07/06 20:37:29 nicm Exp $ */ +/* $OpenBSD: grid.c,v 1.98 2019/07/16 10:30:56 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott @@ -547,7 +547,7 @@ grid_clear(struct grid *gd, u_int px, u_int py, u_int nx, u_int ny, u_int bg) { struct grid_line *gl; - u_int xx, yy; + u_int xx, yy, ox, sx; if (nx == 0 || ny == 0) return; @@ -564,16 +564,20 @@ for (yy = py; yy < py + ny; yy++) { gl = &gd->linedata[yy]; - if (px + nx >= gd->sx && px < gl->cellused) - gl->cellused = px; - if (px > gl->cellsize && COLOUR_DEFAULT(bg)) - continue; - if (px + nx >= gl->cellsize && COLOUR_DEFAULT(bg)) { - gl->cellsize = px; - continue; + + sx = gd->sx; + if (sx > gl->cellsize) + sx = gl->cellsize; + ox = nx; + if (COLOUR_DEFAULT(bg)) { + if (px > sx) + continue; + if (px + nx > sx) + ox = sx - px; } - grid_expand_line(gd, yy, px + nx, 8); /* default bg first */ - for (xx = px; xx < px + nx; xx++) + + grid_expand_line(gd, yy, px + ox, 8); /* default bg first */ + for (xx = px; xx < px + ox; xx++) grid_clear_cell(gd, xx, yy, bg); } } @@ -1215,6 +1219,10 @@ struct grid_line *gl; struct grid_cell gc; u_int yy, width, i, at, first; + + /* Do not reflow to the same size. */ + if (sx == gd->sx) + return; /* * Create a destination grid. This is just used as a container for the