From dab6428859057e870012dd01f4f131d56ccab2ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Wed, 25 Aug 2021 13:57:35 +0200 Subject: [PATCH] =?UTF-8?q?particle/map:=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/map.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/particles/map.c b/particles/map.c index e2d8c03..980bdd1 100644 --- a/particles/map.c +++ b/particles/map.c @@ -41,11 +41,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; }