if (check_display
&& PT > BEGV && PT < ZV
&& !NILP (val = get_char_property_and_overlay
- (make_number (PT), Qdisplay, Qnil, &overlay))
+ (make_number (PT), Qdisplay, selected_window,
+ &overlay))
&& display_prop_intangible_p (val, overlay, PT, PT_BYTE)
&& (!OVERLAYP (overlay)
? get_property_and_range (PT, Qdisplay, &val, &beg, &end, Qnil)
{
start_pos = *position;
*position = display_prop_end (it, object, start_pos);
+ /* If the display property comes from an overlay, don't consider
+ any potential stop_charpos values before the end of that
+ overlay. Since display_prop_end will happily find another
+ 'display' property coming from some other overlay or text
+ property on buffer positions before this overlay's end, we
+ need to ignore them, or else we risk displaying this
+ overlay's display string/image twice. */
+ if (!NILP (overlay))
+ {
+ ptrdiff_t ovendpos = OVERLAY_POSITION (OVERLAY_END (overlay));
+
+ if (ovendpos > CHARPOS (*position))
+ SET_TEXT_POS (*position, ovendpos, CHAR_TO_BYTE (ovendpos));
+ }
}
value = Qnil;