]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix glyph_row reversed_p flag in empty lines between paragraphs.
authorEli Zaretskii <eliz@gnu.org>
Sun, 28 Mar 2010 15:18:10 +0000 (11:18 -0400)
committerEli Zaretskii <eliz@gnu.org>
Sun, 28 Mar 2010 15:18:10 +0000 (11:18 -0400)
 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.

src/ChangeLog.bidi
src/bidi.c
src/dispextern.h
src/xdisp.c

index 9e0236fcefb3da48a06d055117d325bc1d5480bd..d27f747466b2028b594186408c10cfd00c12b73b 100644 (file)
@@ -1,3 +1,14 @@
+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
index 5c0169071ffb6877fc8950558c1624077df9bf4f..8089bf811a67888b0d0b8d8af0f9e818786325fb 100644 (file)
@@ -1901,7 +1901,7 @@ bidi_get_next_char_visually (struct bidi_it *bidi_it)
 
   /* 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;
@@ -1959,7 +1959,9 @@ bidi_get_next_char_visually (struct bidi_it *bidi_it)
      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)
index 03b35df397ce42be8edb0a183c839fe922229632..5083199c529ef122812963c1a42cdb105e967e35 100644 (file)
@@ -2399,6 +2399,13 @@ struct it
 #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                                                \
index f2e06c0a2e73dee60714962100b227495fc30b4c..867018180aac969bf7c5df0d092ee27d9aab89cf 100644 (file)
@@ -3869,15 +3869,6 @@ handle_invisible_prop (it)
                     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
                {
@@ -6235,16 +6226,7 @@ set_iterator_to_next (it, reseat_p)
              /* 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;
@@ -6705,15 +6687,6 @@ next_element_from_buffer (it)
          || 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
@@ -6728,13 +6701,6 @@ next_element_from_buffer (it)
          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