From: Eli Zaretskii Date: Thu, 12 Dec 2019 11:16:46 +0000 (+0200) Subject: Fix face extension of overlay strings on buffer text with faces X-Git-Tag: emacs-27.0.90~371 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=6ee3675dad6f2404d4177aa1ec8eada7286994f4;p=emacs.git Fix face extension of overlay strings on buffer text with faces * src/xdisp.c (face_at_pos): Reject the face returned by 'underlying_face_id' when we are filtering by face attribute, and that attribute's value fails the filter test. (Bug#38563) --- diff --git a/src/xdisp.c b/src/xdisp.c index 08c6927052c..bfc48e36a99 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -4243,11 +4243,25 @@ face_at_pos (const struct it *it, enum lface_attribute_index attr_filter) the display string do. This sounds like a design bug, but Emacs always did that since v21.1, so changing that might be a big deal. */ - base_face_id = it->string_from_prefix_prop_p - ? (!NILP (Vface_remapping_alist) - ? lookup_basic_face (it->w, it->f, DEFAULT_FACE_ID) - : DEFAULT_FACE_ID) - : underlying_face_id (it); + bool use_default = (it->string_from_prefix_prop_p != 0); + if (!use_default) + { + base_face_id = underlying_face_id (it); + /* Reject the underlying face, if that face is different + from the iterator face, and we filter by attr_filter, + and that face's value of the filter attribute is nil + or unspecified; use the default face instead. */ + struct face *bf = FACE_FROM_ID_OR_NULL (it->f, base_face_id); + if (base_face_id != it->base_face_id + && attr_filter > 0 + && (NILP (bf->lface[attr_filter]) + || EQ (bf->lface[attr_filter], Qunspecified))) + use_default = true; + } + if (use_default) + base_face_id = (!NILP (Vface_remapping_alist) + ? lookup_basic_face (it->w, it->f, DEFAULT_FACE_ID) + : DEFAULT_FACE_ID); } return face_at_string_position (it->w,