emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master dd3f213: A better fix for extension of overlay string's faces


From: Eli Zaretskii
Subject: master dd3f213: A better fix for extension of overlay string's faces
Date: Fri, 13 Dec 2019 05:30:21 -0500 (EST)

branch: master
commit dd3f2130cf2977cff79101e72cff0b433df1c1c6
Author: Eli Zaretskii <address@hidden>
Commit: Eli Zaretskii <address@hidden>

    A better fix for extension of overlay string's faces
    
    * src/xdisp.c (face_at_pos): Revert previous change that
    rejected the underlying face if it failed the filtering
    criteria.
    * src/xfaces.c (face_at_string_position): Reset the base face's
    attribute used for filtering faces if the attribute is t.
    (Bug#38563)
---
 src/xdisp.c  | 25 +++++--------------------
 src/xfaces.c |  4 ++++
 2 files changed, 9 insertions(+), 20 deletions(-)

diff --git a/src/xdisp.c b/src/xdisp.c
index bb370bb..4ddde1b 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -4243,26 +4243,11 @@ 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.  */
-         bool use_default = (it->string_from_prefix_prop_p != 0);
-         base_face_id = DEFAULT_FACE_ID;
-         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);
+         base_face_id = it->string_from_display_prop_p
+           ? (!NILP (Vface_remapping_alist)
+              ? lookup_basic_face (it->w, it->f, DEFAULT_FACE_ID)
+              : DEFAULT_FACE_ID)
+           : underlying_face_id (it);
        }
 
       return face_at_string_position (it->w,
diff --git a/src/xfaces.c b/src/xfaces.c
index 54b5f4a..5c347d4 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -6445,6 +6445,10 @@ face_at_string_position (struct window *w, Lisp_Object 
string,
 
   /* Begin with attributes from the base face.  */
   memcpy (attrs, base_face->lface, sizeof attrs);
+  /* Reset the attribute of the base face used as the filter, because
+     otherwise there's no way for faces to be merged to countermand that.  */
+  if (EQ (attrs[attr_filter], Qt))
+    attrs[attr_filter] = Qnil;
 
   /* Merge in attributes specified via text properties.  */
   if (!NILP (prop))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]