acme: avoid division by zero when resizing col (#189)

To reproduce, create a column with at least two windows and resize
acme to have almost zero height.
This commit is contained in:
Fazlul Shahriar 2018-11-13 23:11:31 -05:00 committed by Russ Cox
parent 2419c93438
commit 76b9347a5f

View file

@ -250,8 +250,12 @@ colresize(Column *c, Rectangle r)
w->maxlines = 0;
if(i == c->nw-1)
r1.max.y = r.max.y;
else
r1.max.y = r1.min.y+(Dy(w->r)+Border)*Dy(r)/Dy(c->r);
else{
r1.max.y = r1.min.y;
if(Dy(c->r) != 0){
r1.max.y += (Dy(w->r)+Border)*Dy(r)/Dy(c->r);
}
}
r1.max.y = max(r1.max.y, r1.min.y + Border+font->height);
r2 = r1;
r2.max.y = r2.min.y+Border;