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 35564bea4d)
This commit is contained in:
Eli Zaretskii 2020-07-30 16:56:36 +03:00
parent 63f614d76c
commit f946e48bf5
3 changed files with 5 additions and 4 deletions

View file

@ -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);

View file

@ -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
{

View file

@ -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;