aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2011-06-16 19:32:33 +0300
committerEli Zaretskii2011-06-16 19:32:33 +0300
commit578b494e52299cde50995fadee1a41f5bae0a573 (patch)
tree5c564f244affd112f15a91c02526c1fc077707bc /src
parent9f2573525cdb8fa7b2995a850380a4e267a544b7 (diff)
downloademacs-578b494e52299cde50995fadee1a41f5bae0a573.tar.gz
emacs-578b494e52299cde50995fadee1a41f5bae0a573.zip
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/ChangeLog13
-rw-r--r--src/bidi.c4
-rw-r--r--src/xdisp.c20
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 @@
12011-06-16 Eli Zaretskii <eliz@gnu.org>
2
3 * xdisp.c (init_iterator): Don't initialize it->bidi_p for strings
4 here.
5 (reseat_to_string): Initialize it->bidi_p for strings here.
6 (next_element_from_string, next_element_from_c_string)
7 (next_element_from_buffer): Add xassert's for correspondence
8 between IT's object being iterated and it->bidi_it.string
9 structure.
10
11 * bidi.c (bidi_level_of_next_char): Fix the logic for looking up
12 the sentinel state in the cache.
13
12011-06-13 Eli Zaretskii <eliz@gnu.org> 142011-06-13 Eli Zaretskii <eliz@gnu.org>
2 15
3 * xdisp.c (compute_display_string_pos) 16 * 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)
1660 bidi_type_t type; 1660 bidi_type_t type;
1661 int level, prev_level = -1; 1661 int level, prev_level = -1;
1662 struct bidi_saved_info next_for_neutral; 1662 struct bidi_saved_info next_for_neutral;
1663 EMACS_INT next_char_pos = -1; 1663 EMACS_INT next_char_pos = -2;
1664 1664
1665 if (bidi_it->scan_dir == 1) 1665 if (bidi_it->scan_dir == 1)
1666 { 1666 {
@@ -1726,7 +1726,7 @@ bidi_level_of_next_char (struct bidi_it *bidi_it)
1726 that's the "position" of the sentinel iterator state we 1726 that's the "position" of the sentinel iterator state we
1727 cached at the beginning of the iteration. */ 1727 cached at the beginning of the iteration. */
1728 next_char_pos = bidi_it->charpos - 1; 1728 next_char_pos = bidi_it->charpos - 1;
1729 if (next_char_pos >= 0) 1729 if (next_char_pos >= bob - 1)
1730 type = bidi_cache_find (next_char_pos, -1, bidi_it); 1730 type = bidi_cache_find (next_char_pos, -1, bidi_it);
1731 else 1731 else
1732 type = UNKNOWN_BT; 1732 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,
2405 /* Are multibyte characters enabled in current_buffer? */ 2405 /* Are multibyte characters enabled in current_buffer? */
2406 it->multibyte_p = !NILP (BVAR (current_buffer, enable_multibyte_characters)); 2406 it->multibyte_p = !NILP (BVAR (current_buffer, enable_multibyte_characters));
2407 2407
2408
2409 /* Bidirectional reordering of strings is controlled by the default
2410 value of bidi-display-reordering. For buffers, we reconsider
2411 this below. */
2412 it->bidi_p =
2413 !NILP (BVAR (&buffer_defaults, bidi_display_reordering)) && it->multibyte_p;
2414
2415 /* Non-zero if we should highlight the region. */ 2408 /* Non-zero if we should highlight the region. */
2416 highlight_region_p 2409 highlight_region_p
2417 = (!NILP (Vtransient_mark_mode) 2410 = (!NILP (Vtransient_mark_mode)
@@ -5596,6 +5589,12 @@ reseat_to_string (struct it *it, const char *s, Lisp_Object string,
5596 if (multibyte >= 0) 5589 if (multibyte >= 0)
5597 it->multibyte_p = multibyte > 0; 5590 it->multibyte_p = multibyte > 0;
5598 5591
5592 /* Bidirectional reordering of strings is controlled by the default
5593 value of bidi-display-reordering. */
5594 it->bidi_p =
5595 !NILP (BVAR (&buffer_defaults, bidi_display_reordering))
5596 && it->multibyte_p;
5597
5599 if (s == NULL) 5598 if (s == NULL)
5600 { 5599 {
5601 xassert (STRINGP (string)); 5600 xassert (STRINGP (string));
@@ -5607,7 +5606,6 @@ reseat_to_string (struct it *it, const char *s, Lisp_Object string,
5607 5606
5608 if (it->bidi_p) 5607 if (it->bidi_p)
5609 { 5608 {
5610 it->paragraph_embedding = NEUTRAL_DIR;
5611 it->bidi_it.string.lstring = string; 5609 it->bidi_it.string.lstring = string;
5612 it->bidi_it.string.s = NULL; 5610 it->bidi_it.string.s = NULL;
5613 it->bidi_it.string.schars = it->end_charpos; 5611 it->bidi_it.string.schars = it->end_charpos;
@@ -5632,7 +5630,6 @@ reseat_to_string (struct it *it, const char *s, Lisp_Object string,
5632 5630
5633 if (it->bidi_p) 5631 if (it->bidi_p)
5634 { 5632 {
5635 it->paragraph_embedding = NEUTRAL_DIR;
5636 it->bidi_it.string.lstring = Qnil; 5633 it->bidi_it.string.lstring = Qnil;
5637 it->bidi_it.string.s = s; 5634 it->bidi_it.string.s = s;
5638 it->bidi_it.string.schars = it->end_charpos; 5635 it->bidi_it.string.schars = it->end_charpos;
@@ -6582,6 +6579,7 @@ next_element_from_string (struct it *it)
6582 struct text_pos position; 6579 struct text_pos position;
6583 6580
6584 xassert (STRINGP (it->string)); 6581 xassert (STRINGP (it->string));
6582 xassert (!it->bidi_p || it->string == it->bidi_it.string.lstring);
6585 xassert (IT_STRING_CHARPOS (*it) >= 0); 6583 xassert (IT_STRING_CHARPOS (*it) >= 0);
6586 position = it->current.string_pos; 6584 position = it->current.string_pos;
6587 6585
@@ -6795,6 +6793,7 @@ next_element_from_c_string (struct it *it)
6795 int success_p = 1; 6793 int success_p = 1;
6796 6794
6797 xassert (it->s); 6795 xassert (it->s);
6796 xassert (!it->bidi_p || it->s == it->bidi_it.string.s);
6798 it->what = IT_CHARACTER; 6797 it->what = IT_CHARACTER;
6799 BYTEPOS (it->position) = CHARPOS (it->position) = 0; 6798 BYTEPOS (it->position) = CHARPOS (it->position) = 0;
6800 it->object = Qnil; 6799 it->object = Qnil;
@@ -6933,6 +6932,9 @@ next_element_from_buffer (struct it *it)
6933 int success_p = 1; 6932 int success_p = 1;
6934 6933
6935 xassert (IT_CHARPOS (*it) >= BEGV); 6934 xassert (IT_CHARPOS (*it) >= BEGV);
6935 xassert (!it->bidi_p
6936 || (it->bidi_it.string.lstring == Qnil
6937 && it->bidi_it.string.s == NULL));
6936 6938
6937 /* With bidi reordering, the character to display might not be the 6939 /* With bidi reordering, the character to display might not be the
6938 character at IT_CHARPOS. BIDI_IT.FIRST_ELT non-zero means that 6940 character at IT_CHARPOS. BIDI_IT.FIRST_ELT non-zero means that