tacme: avoid division by zero when resizing col (#189) - plan9port - [fork] Plan 9 from user space (HTM) git clone git://src.adamsgaard.dk/plan9port (DIR) Log (DIR) Files (DIR) Refs (DIR) README (DIR) LICENSE --- (DIR) commit 76b9347a5fa3a0970527c6ee1b97ef1c714f636b (DIR) parent 2419c9343827a679353a8c0a44fd6e0e3e631a3c (HTM) Author: Fazlul Shahriar <fshahriar@gmail.com> Date: Tue, 13 Nov 2018 23:11:31 -0500 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: M src/cmd/acme/cols.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) --- (DIR) diff --git a/src/cmd/acme/cols.c b/src/cmd/acme/cols.c t@@ -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;