]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix face merging at EOL when inherited face specifies :extend
authorEli Zaretskii <eliz@gnu.org>
Tue, 11 Aug 2020 14:39:35 +0000 (17:39 +0300)
committerEli Zaretskii <eliz@gnu.org>
Tue, 11 Aug 2020 14:39:35 +0000 (17:39 +0300)
* src/xfaces.c (merge_face_ref): Handle correctly faces that
inherit from another, and in addition specify :extend.
(Bug#42552)

src/xfaces.c

index 585cfa1cf4ac2c0395d10d54a4ea3c80066467d3..2c6e593f6311ad9faa40fabc3a3ab113aa573562 100644 (file)
@@ -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))