ref: 2b5db0d9d451dafa70039dc0a668cde68e59d4f3
parent: a181f3dd3e922e7acc5a3f4982584e845bddec3c
author: Ori Bernstein <[email protected]>
date: Wed Dec 4 07:37:07 EST 2019
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. (imported from plan9port commit 76b9347a5fa3a0970527c6ee1b97ef1c714f636b)
--- a/sys/src/cmd/acme/cols.c
+++ b/sys/src/cmd/acme/cols.c
@@ -197,8 +197,11 @@
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);
+ }
r2 = r1;
r2.max.y = r2.min.y+Border;
draw(screen, r2, display->black, nil, ZP);