This was causing random crashes, so it's clearly still wrong and I've
reverted back to before any of these changes. I don't have time to look
into it further but maybe you want to have a look (with valgrind
maybe?).

Cheers


On Mon, Dec 01, 2014 at 10:23:54PM +0000, Nicholas Marriott wrote:
> 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

------------------------------------------------------------------------------
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
_______________________________________________
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users

Reply via email to