Fix display of overlapping window-specific overlays
* src/keyboard.c (adjust_point_for_property): When adjusting point due to display strings, ignore overlays that are specific to windows other than the currently selected one. * src/xdisp.c (handle_single_display_spec): If the display property comes from an overlay, arrange for buffer iteration to resume only after the end of that overlay. (Bug#20607)
This commit is contained in:
parent
08033db08b
commit
18338b1dff
2 changed files with 16 additions and 1 deletions
|
@ -1702,7 +1702,8 @@ adjust_point_for_property (ptrdiff_t last_pt, bool modified)
|
|||
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)
|
||||
|
|
14
src/xdisp.c
14
src/xdisp.c
|
@ -4899,6 +4899,20 @@ handle_single_display_spec (struct it *it, Lisp_Object spec, Lisp_Object object,
|
|||
{
|
||||
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;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue