From: Eli Zaretskii Date: Thu, 17 Jul 2014 15:17:52 +0000 (+0300) Subject: Fix part of bug #18035 with overlay strings on invisible text. X-Git-Tag: emacs-24.3.93~63 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=137448c0939848661fdf6e89075c1ac706d30c5e;p=emacs.git Fix part of bug #18035 with overlay strings on invisible text. 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. --- diff --git a/src/ChangeLog b/src/ChangeLog index a664b12fe6e..463c895e5da 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2014-07-17 Eli Zaretskii + + * 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 * xdisp.c (move_it_vertically_backward, move_it_by_lines): Prevent diff --git a/src/xdisp.c b/src/xdisp.c index 263f499dbfa..3ab1dd76654 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -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) {