+2010-03-28 Eli Zaretskii <eliz@gnu.org>
+
+ * bidi.c (bidi_get_next_char_visually): Improve commentary.
+
+ * dispextern.h (PRODUCE_GLYPHS): Set the reversed_p flag in the
+ iterator's glyph_row here.
+
+ * xdisp.c (handle_invisible_prop, set_iterator_to_next)
+ (next_element_from_buffer): Don't set the reversed_p flag in the
+ iterator's glyph_row here.
+
2010-03-20 Eli Zaretskii <eliz@gnu.org>
* xdisp.c (set_cursor_from_row): Don't miss a candidate row whose
/* Reordering of resolved levels (clause L2) is implemented by
jumping to the other edge of the level and flipping direction of
- scanning the buffer whenever we find a level change. */
+ scanning the text whenever we find a level change. */
if (new_level != old_level)
{
int ascending = new_level > old_level;
paragraph direction, if needed. We do this at the newline before
the paragraph separator, because the next character might not be
the first character of the next paragraph, due to the bidi
- reordering. */
+ reordering, whereas we _must_ know the paragraph base direction
+ _before_ we process the paragraph's text, since the base
+ direction affects the reordering. */
if (bidi_it->scan_dir == 1
&& bidi_it->orig_type == NEUTRAL_B
&& bidi_it->bytepos < ZV_BYTE)
#define PRODUCE_GLYPHS(IT) \
do { \
extern int inhibit_free_realized_faces; \
+ if ((IT)->glyph_row != NULL && (IT)->bidi_p) \
+ { \
+ if ((IT)->bidi_it.paragraph_dir == R2L) \
+ (IT)->glyph_row->reversed_p = 1; \
+ else \
+ (IT)->glyph_row->reversed_p = 0; \
+ } \
if (FRAME_RIF ((IT)->f) != NULL) \
FRAME_RIF ((IT)->f)->produce_glyphs ((IT)); \
else \
skip any text at the beginning, which resets the
FIRST_ELT flag. */
bidi_paragraph_init (it->paragraph_embedding, &it->bidi_it);
- /* If the paragraph base direction is R2L, its
- glyphs should be reversed. */
- if (it->glyph_row)
- {
- if (it->bidi_it.paragraph_dir == R2L)
- it->glyph_row->reversed_p = 1;
- else
- it->glyph_row->reversed_p = 0;
- }
}
do
{
/* If this is a new paragraph, determine its base
direction (a.k.a. its base embedding level). */
if (it->bidi_it.new_paragraph)
- {
- bidi_paragraph_init (it->paragraph_embedding, &it->bidi_it);
- if (it->glyph_row)
- {
- if (it->bidi_it.paragraph_dir == R2L)
- it->glyph_row->reversed_p = 1;
- else
- it->glyph_row->reversed_p = 0;
- }
- }
+ bidi_paragraph_init (it->paragraph_embedding, &it->bidi_it);
bidi_get_next_char_visually (&it->bidi_it);
IT_BYTEPOS (*it) = it->bidi_it.bytepos;
IT_CHARPOS (*it) = it->bidi_it.charpos;
|| FETCH_CHAR (it->bidi_it.bytepos) == '\n')
{
bidi_paragraph_init (it->paragraph_embedding, &it->bidi_it);
- /* If the paragraph base direction is R2L, its glyphs should
- be reversed. */
- if (it->glyph_row)
- {
- if (it->bidi_it.paragraph_dir == R2L)
- it->glyph_row->reversed_p = 1;
- else
- it->glyph_row->reversed_p = 0;
- }
bidi_get_next_char_visually (&it->bidi_it);
}
else
it->bidi_it.charpos = IT_CHARPOS (*it);
it->bidi_it.bytepos = IT_BYTEPOS (*it);
bidi_paragraph_init (it->paragraph_embedding, &it->bidi_it);
- if (it->glyph_row)
- {
- if (it->bidi_it.paragraph_dir == R2L)
- it->glyph_row->reversed_p = 1;
- else
- it->glyph_row->reversed_p = 0;
- }
do
{
/* Now return to buffer position where we were asked to