]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix bug #10903 with displaying an empty display string.
authorEli Zaretskii <eliz@gnu.org>
Wed, 29 Feb 2012 17:50:24 +0000 (19:50 +0200)
committerEli Zaretskii <eliz@gnu.org>
Wed, 29 Feb 2012 17:50:24 +0000 (19:50 +0200)
 src/xdisp.c (get_overlay_strings_1): Under bidi redisplay, call
 push_it before setting up the iterator for the first overlay
 string, even if we have an empty string loaded.
 (next_overlay_string): If there's an empty string on the iterator
 stack, pop the stack.

src/ChangeLog
src/xdisp.c

index 9221041da521afe646b1fba428eb2153c33c2ad9..428d25f7cc8509f45588bd23a8ac49decad7f0fc 100644 (file)
@@ -1,3 +1,11 @@
+2012-02-29  Eli Zaretskii  <eliz@gnu.org>
+
+       * xdisp.c (get_overlay_strings_1): Under bidi redisplay, call
+       push_it before setting up the iterator for the first overlay
+       string, even if we have an empty string loaded.
+       (next_overlay_string): If there's an empty string on the iterator
+       stack, pop the stack.  (Bug#10903)
+
 2012-02-25  Paul Eggert  <eggert@cs.ucla.edu>
 
        Generalize fix for crash due to non-contiguous EMACS_INT (Bug#10780).
index 70c12497e20516c7a27a181e90b05665cf2dfc4e..644658b3136a43f6bd909156091eed9a51979eb1 100644 (file)
@@ -5156,6 +5156,12 @@ next_overlay_string (struct it *it)
       it->current.overlay_string_index = -1;
       it->n_overlay_strings = 0;
       it->overlay_strings_charpos = -1;
+      /* If there's an empty display string on the stack, pop the
+        stack, to resync the bidi iterator with IT's position.  Such
+        empty strings are pushed onto the stack in
+        get_overlay_strings_1.  */
+      if (it->sp > 0 && STRINGP (it->string) && !SCHARS (it->string))
+       pop_it (it);
 
       /* If we're at the end of the buffer, record that we have
         processed the overlay strings there already, so that
@@ -5453,8 +5459,15 @@ get_overlay_strings_1 (struct it *it, EMACS_INT charpos, int compute_stop_p)
       xassert (!compute_stop_p || it->sp == 0);
 
       /* When called from handle_stop, there might be an empty display
-         string loaded.  In that case, don't bother saving it.  */
-      if (!STRINGP (it->string) || SCHARS (it->string))
+         string loaded.  In that case, don't bother saving it.  But
+         don't use this optimization with the bidi iterator, since we
+         need the corresponding pop_it call to resync the bidi
+         iterator's position with IT's position, after we are done
+         with the overlay strings.  (The corresponding call to pop_it
+         in case of an empty display string is in
+         next_overlay_string.)  */
+      if (!(!it->bidi_p
+           && STRINGP (it->string) && !SCHARS (it->string)))
        push_it (it, NULL);
 
       /* Set up IT to deliver display elements from the first overlay