I think this is alright, the calculations seem sensible anyway.
On Sat, Nov 29, 2014 at 09:31:10PM +0000, Balazs Kezes wrote: > Disregard my previous patch, after a little bit of thinking I came up > with this: > > diff --git a/grid-view.c b/grid-view.c > index a34c5a0..0b890d8 100644 > --- a/grid-view.c > +++ b/grid-view.c > @@ -184,9 +184,10 @@ 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->linedata[py].cellsize); > - if (sx < px + nx) > - sx = px + nx; > + if (gd->linedata[py].cellsize + nx < gd->sx) > + sx = grid_view_x(gd, gd->linedata[py].cellsize + nx); > + else > + sx = grid_view_x(gd, gd->sx); > > if (px == sx - 1) > grid_clear(gd, px, py, 1, 1); > > For insertion we need to size it to (cellsize+nx) because we have (nx) > new characters and now the expression (sx-px-nx) cannot go below zero > because (sx-nx) is just (cellsize) and (px) is always strictly smaller > than (cellsize). For the other branch, (gd->sx-px-nx >= 0) is guaranteed > by the calling site. > > And I believe the deletion part is already handled well. > > Let me know if there's a better way of testing this than trial and > error. > > -- > Balazs ------------------------------------------------------------------------------ Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration & more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk _______________________________________________ tmux-users mailing list tmux-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/tmux-users