From b7493ff934553a2d008cce4fb8844d25fd2df998 Mon Sep 17 00:00:00 2001 From: Pip Cet Date: Mon, 27 Apr 2020 08:41:52 +0000 Subject: [PATCH] Fix pixel-width evaluation of negated specs * src/xdisp.c (calc_pixel_width_or_height): Fix evaluation of (- X) SPEC. --- src/xdisp.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/xdisp.c b/src/xdisp.c index 140d134572..1aba4c8901 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -27278,7 +27278,7 @@ calc_pixel_width_or_height (double *res, struct it *it, Lisp_Object prop, recursively calculated values. */ if (EQ (car, Qplus) || EQ (car, Qminus)) { - bool first = true; + ptrdiff_t count = 0; double px; pixels = 0; @@ -27287,13 +27287,13 @@ calc_pixel_width_or_height (double *res, struct it *it, Lisp_Object prop, if (!calc_pixel_width_or_height (&px, it, XCAR (cdr), font, width_p, align_to)) return false; - if (first) - pixels = (EQ (car, Qplus) ? px : -px), first = false; - else + if (count++ == 0) pixels += px; + else + pixels += (EQ (car, Qplus) ? px : -px); cdr = XCDR (cdr); } - if (EQ (car, Qminus)) + if (EQ (car, Qminus) && count == 1) pixels = -pixels; return OK_PIXELS (pixels); } -- 2.26.2