summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2010-03-28 11:18:10 -0400
committerEli Zaretskii <eliz@gnu.org>2010-03-28 11:18:10 -0400
commitc0546589ab9573047bb0d6cb82e27fe29221b71a (patch)
treecb3ca8a0384a635a036bbf5ec577907a7ad1d660 /src
parente7dbdb6dfc3ffdc25f8d32a43683500f596d9784 (diff)
downloademacs-c0546589ab9573047bb0d6cb82e27fe29221b71a.tar.gz
Fix glyph_row reversed_p flag in empty lines between paragraphs.
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.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog.bidi11
-rw-r--r--src/bidi.c6
-rw-r--r--src/dispextern.h7
-rw-r--r--src/xdisp.c36
4 files changed, 23 insertions, 37 deletions
diff --git a/src/ChangeLog.bidi b/src/ChangeLog.bidi
index 9e0236fcefb..d27f747466b 100644
--- a/src/ChangeLog.bidi
+++ b/src/ChangeLog.bidi
@@ -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
diff --git a/src/bidi.c b/src/bidi.c
index 5c0169071ff..8089bf811a6 100644
--- a/src/bidi.c
+++ b/src/bidi.c
@@ -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)
diff --git a/src/dispextern.h b/src/dispextern.h
index 03b35df397c..5083199c529 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -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 \
diff --git a/src/xdisp.c b/src/xdisp.c
index f2e06c0a2e7..867018180aa 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -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