diff options
| author | Eli Zaretskii | 2019-12-13 12:29:05 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2019-12-13 12:29:05 +0200 |
| commit | dd3f2130cf2977cff79101e72cff0b433df1c1c6 (patch) | |
| tree | c2ee6fecadc95a7561e62b8a1dad023a69e14afe /src | |
| parent | 9eaad4de02798c7d71357ac9dced9f5f8af7a9b3 (diff) | |
| download | emacs-dd3f2130cf2977cff79101e72cff0b433df1c1c6.tar.gz emacs-dd3f2130cf2977cff79101e72cff0b433df1c1c6.zip | |
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)
Diffstat (limited to 'src')
| -rw-r--r-- | src/xdisp.c | 25 | ||||
| -rw-r--r-- | src/xfaces.c | 4 |
2 files changed, 9 insertions, 20 deletions
diff --git a/src/xdisp.c b/src/xdisp.c index bb370bbb78f..4ddde1be717 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) | |||
| 4243 | the display string do. This sounds like a design bug, | 4243 | the display string do. This sounds like a design bug, |
| 4244 | but Emacs always did that since v21.1, so changing that | 4244 | but Emacs always did that since v21.1, so changing that |
| 4245 | might be a big deal. */ | 4245 | might be a big deal. */ |
| 4246 | bool use_default = (it->string_from_prefix_prop_p != 0); | 4246 | base_face_id = it->string_from_display_prop_p |
| 4247 | base_face_id = DEFAULT_FACE_ID; | 4247 | ? (!NILP (Vface_remapping_alist) |
| 4248 | if (!use_default) | 4248 | ? lookup_basic_face (it->w, it->f, DEFAULT_FACE_ID) |
| 4249 | { | 4249 | : DEFAULT_FACE_ID) |
| 4250 | base_face_id = underlying_face_id (it); | 4250 | : underlying_face_id (it); |
| 4251 | /* Reject the underlying face, if that face is different | ||
| 4252 | from the iterator face, and we filter by attr_filter, | ||
| 4253 | and that face's value of the filter attribute is nil | ||
| 4254 | or unspecified; use the default face instead. */ | ||
| 4255 | struct face *bf = FACE_FROM_ID_OR_NULL (it->f, base_face_id); | ||
| 4256 | if (base_face_id != it->base_face_id | ||
| 4257 | && attr_filter > 0 | ||
| 4258 | && (NILP (bf->lface[attr_filter]) | ||
| 4259 | || EQ (bf->lface[attr_filter], Qunspecified))) | ||
| 4260 | use_default = true; | ||
| 4261 | } | ||
| 4262 | if (use_default) | ||
| 4263 | base_face_id = (!NILP (Vface_remapping_alist) | ||
| 4264 | ? lookup_basic_face (it->w, it->f, DEFAULT_FACE_ID) | ||
| 4265 | : DEFAULT_FACE_ID); | ||
| 4266 | } | 4251 | } |
| 4267 | 4252 | ||
| 4268 | return face_at_string_position (it->w, | 4253 | return face_at_string_position (it->w, |
diff --git a/src/xfaces.c b/src/xfaces.c index 54b5f4a94a4..5c347d41e30 100644 --- a/src/xfaces.c +++ b/src/xfaces.c | |||
| @@ -6445,6 +6445,10 @@ face_at_string_position (struct window *w, Lisp_Object string, | |||
| 6445 | 6445 | ||
| 6446 | /* Begin with attributes from the base face. */ | 6446 | /* Begin with attributes from the base face. */ |
| 6447 | memcpy (attrs, base_face->lface, sizeof attrs); | 6447 | memcpy (attrs, base_face->lface, sizeof attrs); |
| 6448 | /* Reset the attribute of the base face used as the filter, because | ||
| 6449 | otherwise there's no way for faces to be merged to countermand that. */ | ||
| 6450 | if (EQ (attrs[attr_filter], Qt)) | ||
| 6451 | attrs[attr_filter] = Qnil; | ||
| 6448 | 6452 | ||
| 6449 | /* Merge in attributes specified via text properties. */ | 6453 | /* Merge in attributes specified via text properties. */ |
| 6450 | if (!NILP (prop)) | 6454 | if (!NILP (prop)) |