]> code.delx.au - gnu-emacs/commitdiff
Fix display of overlapping window-specific overlays
authorEli Zaretskii <eliz@gnu.org>
Tue, 19 May 2015 15:39:25 +0000 (18:39 +0300)
committerEli Zaretskii <eliz@gnu.org>
Tue, 19 May 2015 15:39:25 +0000 (18:39 +0300)
* 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)

src/keyboard.c
src/xdisp.c

index 77f7fb9789843704d6c96813e938f2d3a20e453d..eb66c445559e2d01d0b712f87e1fc425ac67f466 100644 (file)
@@ -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)
index c2f0b747c6ea2bc72fa3f999de035299053de237..8123719ed486b2d682079042b9f6bbc2ae374901 100644 (file)
@@ -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;