particle/map: don’t add margins if all sub-items are zero-width

That is, if all sub-items are zero-width, make sure *we* return a zero
width.
This commit is contained in:
Daniel Eklöf 2021-08-25 13:57:35 +02:00
parent 73e1d328c3
commit dab6428859
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F

View file

@ -41,11 +41,13 @@ begin_expose(struct exposable *exposable)
{ {
struct eprivate *e = exposable->private; struct eprivate *e = exposable->private;
exposable->width = ( int width = e->exposable->begin_expose(e->exposable);
exposable->particle->left_margin + assert(width >= 0);
e->exposable->begin_expose(e->exposable) +
exposable->particle->right_margin);
if (width > 0)
width += exposable->particle->left_margin + exposable->particle->right_margin;
exposable->width = width;
return exposable->width; return exposable->width;
} }