Fix bug #10903 with displaying an empty display string.

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.
This commit is contained in:
Eli Zaretskii 2012-02-29 19:50:24 +02:00
parent 2d44d9cc70
commit 312508d72e
2 changed files with 23 additions and 2 deletions

View 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).

View 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