From f946e48bf5bfe051e77eee4c3c19633cbbb6e8c2 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Thu, 30 Jul 2020 16:56:36 +0300 Subject: [PATCH] Fix face extension past EOL in overlay strings * src/xdisp.c (face_at_pos): Pass ATTR_FILTER to face_for_overlay_string. * src/xfaces.c (face_for_overlay_string): Accept an additional argument ATTR_INDEX and pass it to merge_face_ref for merging the face at POS. This ensures a face from buffer text will not be merged unless it specifies the :extend attribute. (Bug#42552) * src/dispextern.h (face_for_overlay_string): Adjust prototype. (cherry picked from commit 35564bea4d73bc266743216599d01d644aed6fd8) --- src/dispextern.h | 2 +- src/xdisp.c | 2 +- src/xfaces.c | 5 +++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/dispextern.h b/src/dispextern.h index 724aad4227e..6b72e68d315 100644 --- a/src/dispextern.h +++ b/src/dispextern.h @@ -3559,7 +3559,7 @@ void recompute_basic_faces (struct frame *); int face_at_buffer_position (struct window *, ptrdiff_t, ptrdiff_t *, ptrdiff_t, bool, int, enum lface_attribute_index); int face_for_overlay_string (struct window *, ptrdiff_t, ptrdiff_t *, ptrdiff_t, - bool, Lisp_Object); + bool, Lisp_Object, enum lface_attribute_index); int face_at_string_position (struct window *, Lisp_Object, ptrdiff_t, ptrdiff_t, ptrdiff_t *, enum face_id, bool, enum lface_attribute_index); diff --git a/src/xdisp.c b/src/xdisp.c index a819f0aca38..37fe3800784 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -4322,7 +4322,7 @@ face_at_pos (const struct it *it, enum lface_attribute_index attr_filter) (IT_CHARPOS (*it) + TEXT_PROP_DISTANCE_LIMIT), false, - from_overlay); + from_overlay, attr_filter); } else { diff --git a/src/xfaces.c b/src/xfaces.c index 711ec48bbdd..12eb7de66e4 100644 --- a/src/xfaces.c +++ b/src/xfaces.c @@ -6330,7 +6330,8 @@ face_at_buffer_position (struct window *w, ptrdiff_t pos, int face_for_overlay_string (struct window *w, ptrdiff_t pos, ptrdiff_t *endptr, ptrdiff_t limit, - bool mouse, Lisp_Object overlay) + bool mouse, Lisp_Object overlay, + enum lface_attribute_index attr_filter) { struct frame *f = XFRAME (w->frame); Lisp_Object attrs[LFACE_VECTOR_SIZE]; @@ -6369,7 +6370,7 @@ face_for_overlay_string (struct window *w, ptrdiff_t pos, /* Merge in attributes specified via text properties. */ if (!NILP (prop)) - merge_face_ref (w, f, prop, attrs, true, NULL, 0); + merge_face_ref (w, f, prop, attrs, true, NULL, attr_filter); *endptr = endpos; -- 2.39.5