diff options
author | Eli Zaretskii <eliz@gnu.org> | 2011-06-16 19:32:33 +0300 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2011-06-16 19:32:33 +0300 |
commit | 578b494e52299cde50995fadee1a41f5bae0a573 (patch) | |
tree | 5c564f244affd112f15a91c02526c1fc077707bc /src | |
parent | 9f2573525cdb8fa7b2995a850380a4e267a544b7 (diff) | |
download | emacs-578b494e52299cde50995fadee1a41f5bae0a573.tar.gz |
Fix display of R2L strings in mode line.
Composed characters still don't work.
src/xdisp.c (init_iterator): Don't initialize it->bidi_p for strings
here.
(reseat_to_string): Initialize it->bidi_p for strings here.
(next_element_from_string, next_element_from_c_string)
(next_element_from_buffer): Add xassert's for correspondence
between IT's object being iterated and it->bidi_it.string
structure.
src/bidi.c (bidi_level_of_next_char): Fix the logic for looking up
the sentinel state in the cache.
Diffstat (limited to 'src')
-rw-r--r-- | src/ChangeLog | 13 | ||||
-rw-r--r-- | src/bidi.c | 4 | ||||
-rw-r--r-- | src/xdisp.c | 20 |
3 files changed, 26 insertions, 11 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 5dc1c62266d..088ed078770 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,16 @@ +2011-06-16 Eli Zaretskii <eliz@gnu.org> + + * xdisp.c (init_iterator): Don't initialize it->bidi_p for strings + here. + (reseat_to_string): Initialize it->bidi_p for strings here. + (next_element_from_string, next_element_from_c_string) + (next_element_from_buffer): Add xassert's for correspondence + between IT's object being iterated and it->bidi_it.string + structure. + + * bidi.c (bidi_level_of_next_char): Fix the logic for looking up + the sentinel state in the cache. + 2011-06-13 Eli Zaretskii <eliz@gnu.org> * xdisp.c (compute_display_string_pos) diff --git a/src/bidi.c b/src/bidi.c index 169a3cb01f6..ac01f65bf4e 100644 --- a/src/bidi.c +++ b/src/bidi.c @@ -1660,7 +1660,7 @@ bidi_level_of_next_char (struct bidi_it *bidi_it) bidi_type_t type; int level, prev_level = -1; struct bidi_saved_info next_for_neutral; - EMACS_INT next_char_pos = -1; + EMACS_INT next_char_pos = -2; if (bidi_it->scan_dir == 1) { @@ -1726,7 +1726,7 @@ bidi_level_of_next_char (struct bidi_it *bidi_it) that's the "position" of the sentinel iterator state we cached at the beginning of the iteration. */ next_char_pos = bidi_it->charpos - 1; - if (next_char_pos >= 0) + if (next_char_pos >= bob - 1) type = bidi_cache_find (next_char_pos, -1, bidi_it); else type = UNKNOWN_BT; diff --git a/src/xdisp.c b/src/xdisp.c index c293dbeaade..00c66d4d3f9 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -2405,13 +2405,6 @@ init_iterator (struct it *it, struct window *w, /* Are multibyte characters enabled in current_buffer? */ it->multibyte_p = !NILP (BVAR (current_buffer, enable_multibyte_characters)); - - /* Bidirectional reordering of strings is controlled by the default - value of bidi-display-reordering. For buffers, we reconsider - this below. */ - it->bidi_p = - !NILP (BVAR (&buffer_defaults, bidi_display_reordering)) && it->multibyte_p; - /* Non-zero if we should highlight the region. */ highlight_region_p = (!NILP (Vtransient_mark_mode) @@ -5596,6 +5589,12 @@ reseat_to_string (struct it *it, const char *s, Lisp_Object string, if (multibyte >= 0) it->multibyte_p = multibyte > 0; + /* Bidirectional reordering of strings is controlled by the default + value of bidi-display-reordering. */ + it->bidi_p = + !NILP (BVAR (&buffer_defaults, bidi_display_reordering)) + && it->multibyte_p; + if (s == NULL) { xassert (STRINGP (string)); @@ -5607,7 +5606,6 @@ reseat_to_string (struct it *it, const char *s, Lisp_Object string, if (it->bidi_p) { - it->paragraph_embedding = NEUTRAL_DIR; it->bidi_it.string.lstring = string; it->bidi_it.string.s = NULL; it->bidi_it.string.schars = it->end_charpos; @@ -5632,7 +5630,6 @@ reseat_to_string (struct it *it, const char *s, Lisp_Object string, if (it->bidi_p) { - it->paragraph_embedding = NEUTRAL_DIR; it->bidi_it.string.lstring = Qnil; it->bidi_it.string.s = s; it->bidi_it.string.schars = it->end_charpos; @@ -6582,6 +6579,7 @@ next_element_from_string (struct it *it) struct text_pos position; xassert (STRINGP (it->string)); + xassert (!it->bidi_p || it->string == it->bidi_it.string.lstring); xassert (IT_STRING_CHARPOS (*it) >= 0); position = it->current.string_pos; @@ -6795,6 +6793,7 @@ next_element_from_c_string (struct it *it) int success_p = 1; xassert (it->s); + xassert (!it->bidi_p || it->s == it->bidi_it.string.s); it->what = IT_CHARACTER; BYTEPOS (it->position) = CHARPOS (it->position) = 0; it->object = Qnil; @@ -6933,6 +6932,9 @@ next_element_from_buffer (struct it *it) int success_p = 1; xassert (IT_CHARPOS (*it) >= BEGV); + xassert (!it->bidi_p + || (it->bidi_it.string.lstring == Qnil + && it->bidi_it.string.s == NULL)); /* With bidi reordering, the character to display might not be the character at IT_CHARPOS. BIDI_IT.FIRST_ELT non-zero means that |