aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/acme
diff options
context:
space:
mode:
authorFazlul Shahriar <fshahriar@gmail.com>2018-11-13 23:11:31 -0500
committerRuss Cox <rsc@golang.org>2018-11-13 23:11:31 -0500
commit76b9347a5fa3a0970527c6ee1b97ef1c714f636b (patch)
tree93589623fdddb505ab16caa38d25d49d700ce546 /src/cmd/acme
parent2419c9343827a679353a8c0a44fd6e0e3e631a3c (diff)
downloadplan9port-76b9347a5fa3a0970527c6ee1b97ef1c714f636b.tar.gz
plan9port-76b9347a5fa3a0970527c6ee1b97ef1c714f636b.tar.bz2
plan9port-76b9347a5fa3a0970527c6ee1b97ef1c714f636b.zip
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.
Diffstat (limited to 'src/cmd/acme')
-rw-r--r--src/cmd/acme/cols.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/cmd/acme/cols.c b/src/cmd/acme/cols.c
index 10e014ee..b1fe23ba 100644
--- a/src/cmd/acme/cols.c
+++ b/src/cmd/acme/cols.c
@@ -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;