From af0b7e57d8fdcc3abf9ce685d45104ee3efdd5e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Wed, 25 Aug 2021 13:58:20 +0200 Subject: [PATCH] =?UTF-8?q?particle/ramp:=20don=E2=80=99t=20add=20margins?= =?UTF-8?q?=20if=20all=20sub-items=20are=20zero-width?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit That is, if all sub-items are zero-width, make sure *we* return a zero width. --- particles/ramp.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/particles/ramp.c b/particles/ramp.c index 3fa2fc8..1d4cb59 100644 --- a/particles/ramp.c +++ b/particles/ramp.c @@ -37,11 +37,13 @@ begin_expose(struct exposable *exposable) { struct eprivate *e = exposable->private; - exposable->width = ( - exposable->particle->left_margin + - e->exposable->begin_expose(e->exposable) + - exposable->particle->right_margin); + int width = e->exposable->begin_expose(e->exposable); + assert(width >= 0); + if (width > 0) + width += exposable->particle->left_margin + exposable->particle->right_margin; + + exposable->width = width; return exposable->width; }