]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix part of bug #18035 with overlay strings on invisible text.
authorEli Zaretskii <eliz@gnu.org>
Thu, 17 Jul 2014 15:17:52 +0000 (18:17 +0300)
committerEli Zaretskii <eliz@gnu.org>
Thu, 17 Jul 2014 15:17:52 +0000 (18:17 +0300)
 src/xdisp.c (init_iterator): Initialize it->stop_charpos to the
 buffer position where we are to start the iteration.
 (handle_invisible_prop): Record in it->stop_charpos the position
 where the invisible text ends.

src/ChangeLog
src/xdisp.c

index a664b12fe6e1db08263cb2d655415bf12890fb20..463c895e5da72832b3708a396e228d4793c2714f 100644 (file)
@@ -1,3 +1,10 @@
+2014-07-17  Eli Zaretskii  <eliz@gnu.org>
+
+       * xdisp.c (init_iterator): Initialize it->stop_charpos to the
+       buffer position where we are to start the iteration.
+       (handle_invisible_prop): Record in it->stop_charpos the position
+       where the invisible text ends.  (Bug#18035)
+
 2014-07-16  Eli Zaretskii  <eliz@gnu.org>
 
        * xdisp.c (move_it_vertically_backward, move_it_by_lines): Prevent
index 263f499dbfa7e8b805bcdaf4e88b462ecba62721..3ab1dd766549145d31357903f678d3dada4cbdcf 100644 (file)
@@ -3034,6 +3034,7 @@ init_iterator (struct it *it, struct window *w,
      getting overlays and face properties from that position.  */
   if (charpos >= BUF_BEG (current_buffer))
     {
+      it->stop_charpos = charpos;
       it->end_charpos = ZV;
       eassert (charpos == BYTE_TO_CHAR (bytepos));
       IT_CHARPOS (*it) = charpos;
@@ -4546,7 +4547,24 @@ handle_invisible_prop (struct it *it)
              && get_overlay_strings (it, it->stop_charpos))
            {
              handled = HANDLED_RECOMPUTE_PROPS;
-             it->stack[it->sp - 1].display_ellipsis_p = display_ellipsis_p;
+             if (it->sp > 0)
+               {
+                 it->stack[it->sp - 1].display_ellipsis_p = display_ellipsis_p;
+                 /* The call to get_overlay_strings above recomputes
+                    it->stop_charpos, but it only considers changes
+                    in properties and overlays beyond iterator's
+                    current position.  This causes us to miss changes
+                    that happen exactly where the invisible property
+                    ended.  So we play it safe here and force the
+                    iterator to check for potential stop positions
+                    immediately after the invisible text.  Note that
+                    if get_overlay_strings returns non-zero, it
+                    normally also pushed the iterator stack, so we
+                    need to update the stop position in the slot
+                    below the current one.  */
+                 it->stack[it->sp - 1].stop_charpos
+                   = CHARPOS (it->stack[it->sp - 1].current.pos);
+               }
            }
          else if (display_ellipsis_p)
             {