return retval;
}
+ /* We want the string to inherit the paragraph direction of the
+ parent object, so we need to calculate that if not yet done. */
+ ptrdiff_t eob = (BUFFERP (object) ? ZV : it->end_charpos);
+ if (it->bidi_it.first_elt && it->bidi_it.charpos < eob)
+ bidi_paragraph_init (it->paragraph_embedding, &it->bidi_it, true);
+
/* Save current settings of IT so that we can restore them
when we are finished with the glyph property value. */
push_it (it, position);
if (BUFFERP (object))
*position = start_pos;
- /* Force paragraph direction to be that of the parent
- object. If the parent object's paragraph direction is
- not yet determined, default to L2R. */
+ /* Force paragraph direction to be that of the parent object.
+ If the parent object's paragraph direction is not yet
+ determined (which shouldn not happen, since we called
+ bidi_paragraph_init above), default to L2R. */
if (it->bidi_p && it->bidi_it.paragraph_dir == R2L)
it->paragraph_embedding = it->bidi_it.paragraph_dir;
else
strings have been processed. */
eassert (!compute_stop_p || it->sp == 0);
+ /* We want the string to inherit the paragraph direction of the
+ parent object, so we need to calculate that if not yet done. */
+ if (it->bidi_it.first_elt && it->bidi_it.charpos < ZV)
+ bidi_paragraph_init (it->paragraph_embedding, &it->bidi_it, true);
+
/* When called from handle_stop, there might be an empty display
string loaded. In that case, don't bother saving it. But
don't use this optimization with the bidi iterator, since we
eassert (eob >= CHARPOS (it->position) && CHARPOS (it->position) >= bob);
/* Maybe initialize paragraph direction. If we are at the beginning
- of a new paragraph, next_element_from_buffer may not have a
+ of a new paragraph, next_element_from_buffer may not have had a
chance to do that. */
if (it->bidi_it.first_elt && it->bidi_it.charpos < eob)
bidi_paragraph_init (it->paragraph_embedding, &it->bidi_it, true);
|| it->method == GET_FROM_STRING
|| it->method == GET_FROM_IMAGE);
+ /* We want the string to inherit the paragraph direction of the parent
+ object, so we need to calculate that if not yet done. */
+ ptrdiff_t eob = (STRINGP (it->string) ? SCHARS (it->string) : ZV);
+ if (it->bidi_it.first_elt && it->bidi_it.charpos < eob)
+ bidi_paragraph_init (it->paragraph_embedding, &it->bidi_it, true);
+
/* We need to save the current buffer/string position, so it will be
restored by pop_it, because iterate_out_of_display_property
depends on that being set correctly, but some situations leave