2011-06-25 Eli Zaretskii <eliz@gnu.org>
+ * xdisp.c (set_iterator_to_next, get_visually_first_element): Use
+ it->bidi_it.string.schars rather than it->string_nchars when
+ testing whether we're beyond string end, because string_nchars is
+ zero for strings that come from overlays and display properties.
+
+ * bidi.c (bidi_cache_iterator_state): Fix a bug with testing
+ character positions against the cached range, when we use a
+ stacked cache.
+
+ * xdisp.c (push_it, pop_it): Save and restore it.
+
+ * dispextern.h (struct iterator_stack_entry): New member
+ paragraph_embedding.
+
* xdisp.c (handle_single_display_spec, next_overlay_string)
(get_overlay_strings_1, push_display_prop): Set up the bidi
iterator for displaying display or overlay strings.
p->display_ellipsis_p = 0;
p->line_wrap = it->line_wrap;
p->bidi_p = it->bidi_p;
+ p->paragraph_embedding = it->paragraph_embedding;
++it->sp;
/* Save the state of the bidi iterator as well. */
it->string_from_display_prop_p = p->string_from_display_prop_p;
it->line_wrap = p->line_wrap;
it->bidi_p = p->bidi_p;
+ it->paragraph_embedding = p->paragraph_embedding;
if (it->bidi_p)
{
bidi_pop_it (&it->bidi_it);
case GET_FROM_C_STRING:
/* Current display element of IT is from a C string. */
if (!it->bidi_p
- /* If the string position is beyond string_nchars, it means
+ /* If the string position is beyond string's end, it means
next_element_from_c_string is padding the string with
blanks, in which case we bypass the bidi iterator,
because it cannot deal with such virtual characters. */
- || IT_CHARPOS (*it) >= it->string_nchars)
+ || IT_CHARPOS (*it) >= it->bidi_it.string.schars)
{
IT_BYTEPOS (*it) += it->len;
IT_CHARPOS (*it) += 1;
else
{
if (!it->bidi_p
- /* If the string position is beyond string_nchars, it
+ /* If the string position is beyond string's end, it
means next_element_from_string is padding the string
with blanks, in which case we bypass the bidi
iterator, because it cannot deal with such virtual
characters. */
- || IT_STRING_CHARPOS (*it) >= it->string_nchars)
+ || IT_STRING_CHARPOS (*it) >= it->bidi_it.string.schars)
{
IT_STRING_BYTEPOS (*it) += it->len;
IT_STRING_CHARPOS (*it) += 1;
get_visually_first_element (struct it *it)
{
int string_p = STRINGP (it->string) || it->s;
- EMACS_INT eob = (string_p ? it->string_nchars : ZV);
+ EMACS_INT eob = (string_p ? it->bidi_it.string.schars : ZV);
EMACS_INT bob = (string_p ? 0 : BEGV);
if (STRINGP (it->string))