From 39c90f8dfabe158ad7ac9243aa9b9dedb9409e19 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Tue, 11 Aug 2020 17:39:35 +0300 Subject: [PATCH] Fix face merging at EOL when inherited face specifies :extend * src/xfaces.c (merge_face_ref): Handle correctly faces that inherit from another, and in addition specify :extend. (Bug#42552) --- src/xfaces.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/xfaces.c b/src/xfaces.c index 585cfa1cf4a..2c6e593f631 100644 --- a/src/xfaces.c +++ b/src/xfaces.c @@ -2517,6 +2517,7 @@ merge_face_ref (struct window *w, { bool ok = true; /* Succeed without an error? */ Lisp_Object filtered_face_ref; + bool attr_filter_passed = false; filtered_face_ref = face_ref; do @@ -2613,6 +2614,7 @@ merge_face_ref (struct window *w, || UNSPECIFIEDP (scratch_attrs[attr_filter])) return true; } + attr_filter_passed = true; } while (CONSP (face_ref) && CONSP (XCDR (face_ref))) { @@ -2776,9 +2778,21 @@ merge_face_ref (struct window *w, { /* This is not really very useful; it's just like a normal face reference. */ - if (! merge_face_ref (w, f, value, to, - err_msgs, named_merge_points, - attr_filter)) + if (attr_filter_passed) + { + /* We already know that this face was tested + against attr_filter and was found applicable, + so don't pass attr_filter to merge_face_ref. + This is for when a face is specified like + (:inherit FACE :extend t), but the parent + FACE itself doesn't specify :extend. */ + if (! merge_face_ref (w, f, value, to, + err_msgs, named_merge_points, 0)) + err = true; + } + else if (! merge_face_ref (w, f, value, to, + err_msgs, named_merge_points, + attr_filter)) err = true; } else if (EQ (keyword, QCextend)) -- 2.39.5