aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2010-01-25 12:29:38 -0500
committerEli Zaretskii2010-01-25 12:29:38 -0500
commit5009f85e4241749fe69f83d7edc1e5f6d17b664b (patch)
tree714e9dd8cde78ef7e1fef13f80127b31ad05461e /src
parent151b77c2684759f6f883c012ce8469b68741b6eb (diff)
downloademacs-5009f85e4241749fe69f83d7edc1e5f6d17b664b.tar.gz
emacs-5009f85e4241749fe69f83d7edc1e5f6d17b664b.zip
Finish and debug display of invisible text.
xdisp.c (handle_invisible_prop): If we are `reseat'ed, init the paragraph direction and set the `reversed_p' flag in the IT's glyph row. Fix exit conditions of the loop that skips invisible text. Update IT->prev_stop after skipping invisible text. Check for additional overlays at IT->stop_charpos, not at start_pos. Clean up the mess with setting the glyph row reversed_p flag. dispnew.c (prepare_desired_row): Preserve the reversed_p flag. bidi.c (bidi_cache_find): Use bidi_copy_it instead of copying the whole struct (which includes uninitialized parts). (bidi_init_it): Don't initialize bidi_it->paragraph_dir. xdisp.c (display_line): Remove misplaced setting of row->reversed_p flags. Copy the reversed_p flag to the next glyph row. (next_element_from_buffer): Check bidi_it.paragraph_dir rather than level_stack[0].level. Reset the reversed_p flag for non-R2L paragraphs.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog.bidi24
-rw-r--r--src/bidi.c3
-rw-r--r--src/dispnew.c3
-rw-r--r--src/xdisp.c77
4 files changed, 89 insertions, 18 deletions
diff --git a/src/ChangeLog.bidi b/src/ChangeLog.bidi
index 40a858b0320..cbd1813cba2 100644
--- a/src/ChangeLog.bidi
+++ b/src/ChangeLog.bidi
@@ -1,3 +1,27 @@
12010-01-25 Eli Zaretskii <eliz@gnu.org>
2
3 Clean up the mess with setting the glyph row reversed_p flag.
4 * dispnew.c (prepare_desired_row): Preserve the reversed_p flag.
5
6 * bidi.c (bidi_cache_find): Use bidi_copy_it instead of copying
7 the whole struct (which includes uninitialized parts).
8 (bidi_init_it): Don't initialize bidi_it->paragraph_dir.
9
10 * xdisp.c (display_line): Remove misplaced setting of
11 row->reversed_p flags. Copy the reversed_p flag to the next glyph
12 row.
13 (next_element_from_buffer): Check bidi_it.paragraph_dir rather
14 than level_stack[0].level. Reset the reversed_p flag for non-R2L
15 paragraphs.
16
17 Fix display of invisible text.
18 * xdisp.c (handle_invisible_prop): If we are `reseat'ed, init the
19 paragraph direction and set the `reversed_p' flag in the IT's
20 glyph row. Fix exit conditions of the loop that skips invisible
21 text. Update IT->prev_stop after skipping invisible text. Check
22 for additional overlays at IT->stop_charpos, not at start_pos.
23 (next_element_from_buffer):
24
12010-01-16 Eli Zaretskii <eliz@gnu.org> 252010-01-16 Eli Zaretskii <eliz@gnu.org>
2 26
3 * xdisp.c (handle_invisible_prop): Under bidi iteration, skip 27 * xdisp.c (handle_invisible_prop): Under bidi iteration, skip
diff --git a/src/bidi.c b/src/bidi.c
index 5abb4ca9f43..5c0169071ff 100644
--- a/src/bidi.c
+++ b/src/bidi.c
@@ -715,7 +715,7 @@ bidi_cache_find (int charpos, int level, struct bidi_it *bidi_it)
715 { 715 {
716 bidi_dir_t current_scan_dir = bidi_it->scan_dir; 716 bidi_dir_t current_scan_dir = bidi_it->scan_dir;
717 717
718 *bidi_it = bidi_cache[i]; 718 bidi_copy_it (bidi_it, &bidi_cache[i]);
719 bidi_cache_last_idx = i; 719 bidi_cache_last_idx = i;
720 /* Don't let scan direction from from the cached state override 720 /* Don't let scan direction from from the cached state override
721 the current scan direction. */ 721 the current scan direction. */
@@ -971,7 +971,6 @@ bidi_init_it (EMACS_INT charpos, EMACS_INT bytepos, struct bidi_it *bidi_it)
971 bidi_set_paragraph_end (bidi_it); 971 bidi_set_paragraph_end (bidi_it);
972 bidi_it->new_paragraph = 1; 972 bidi_it->new_paragraph = 1;
973 bidi_it->separator_limit = -1; 973 bidi_it->separator_limit = -1;
974 bidi_it->paragraph_dir = NEUTRAL_DIR;
975 bidi_it->type = NEUTRAL_B; 974 bidi_it->type = NEUTRAL_B;
976 bidi_it->type_after_w1 = UNKNOWN_BT; 975 bidi_it->type_after_w1 = UNKNOWN_BT;
977 bidi_it->orig_type = UNKNOWN_BT; 976 bidi_it->orig_type = UNKNOWN_BT;
diff --git a/src/dispnew.c b/src/dispnew.c
index 33c1fd89a40..897d38e48f0 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -1388,8 +1388,11 @@ prepare_desired_row (row)
1388{ 1388{
1389 if (!row->enabled_p) 1389 if (!row->enabled_p)
1390 { 1390 {
1391 unsigned rp = row->reversed_p;
1392
1391 clear_glyph_row (row); 1393 clear_glyph_row (row);
1392 row->enabled_p = 1; 1394 row->enabled_p = 1;
1395 row->reversed_p = rp;
1393 } 1396 }
1394} 1397}
1395 1398
diff --git a/src/xdisp.c b/src/xdisp.c
index 17a6f7eb4f0..703676127fa 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -3789,7 +3789,7 @@ handle_invisible_prop (it)
3789 3789
3790 /* First of all, is there invisible text at this position? */ 3790 /* First of all, is there invisible text at this position? */
3791 tem = start_charpos = IT_CHARPOS (*it); 3791 tem = start_charpos = IT_CHARPOS (*it);
3792 pos = make_number (IT_CHARPOS (*it)); 3792 pos = make_number (tem);
3793 prop = get_char_property_and_overlay (pos, Qinvisible, it->window, 3793 prop = get_char_property_and_overlay (pos, Qinvisible, it->window,
3794 &overlay); 3794 &overlay);
3795 invis_p = TEXT_PROP_MEANS_INVISIBLE (prop); 3795 invis_p = TEXT_PROP_MEANS_INVISIBLE (prop);
@@ -3852,17 +3852,43 @@ handle_invisible_prop (it)
3852 embedding level. Therefore, we need to skip 3852 embedding level. Therefore, we need to skip
3853 invisible text using the bidi iterator, starting at 3853 invisible text using the bidi iterator, starting at
3854 IT's current position, until we find ourselves 3854 IT's current position, until we find ourselves
3855 outside the invisible text. This avoids affecting 3855 outside the invisible text. Skipping invisible text
3856 the visual order of the displayed text when invisible 3856 _after_ bidi iteration avoids affecting the visual
3857 properties are added or removed. */ 3857 order of the displayed text when invisible properties
3858 are added or removed. */
3859 if (it->bidi_it.first_elt)
3860 {
3861 /* If we were `reseat'ed to a new paragraph,
3862 determine the paragraph base direction. We need
3863 to do it now because next_element_from_buffer may
3864 not have a chance to do it, if we are going to
3865 skip any text at the beginning, which resets the
3866 FIRST_ELT flag. */
3867 bidi_paragraph_init (it->paragraph_embedding, &it->bidi_it);
3868 /* If the paragraph base direction is R2L, its
3869 glyphs should be reversed. */
3870 if (it->glyph_row)
3871 {
3872 if (it->bidi_it.paragraph_dir == R2L)
3873 it->glyph_row->reversed_p = 1;
3874 else
3875 it->glyph_row->reversed_p = 0;
3876 }
3877 }
3858 do 3878 do
3859 { 3879 {
3860 bidi_get_next_char_visually (&it->bidi_it); 3880 bidi_get_next_char_visually (&it->bidi_it);
3861 } 3881 }
3862 while (start_charpos <= it->bidi_it.charpos 3882 while (it->stop_charpos <= it->bidi_it.charpos
3863 && it->bidi_it.charpos < newpos); 3883 && it->bidi_it.charpos < newpos);
3864 IT_CHARPOS (*it) = it->bidi_it.charpos; 3884 IT_CHARPOS (*it) = it->bidi_it.charpos;
3865 IT_BYTEPOS (*it) = CHAR_TO_BYTE (newpos); 3885 IT_BYTEPOS (*it) = it->bidi_it.bytepos;
3886 /* If we overstepped NEWPOS, record its position in the
3887 iterator, so that we skip invisible text if later the
3888 bidi iteration lands us in the invisible region
3889 again. */
3890 if (IT_CHARPOS (*it) >= newpos)
3891 it->prev_stop = newpos;
3866 } 3892 }
3867 else 3893 else
3868 { 3894 {
@@ -3877,7 +3903,7 @@ handle_invisible_prop (it)
3877 overlay property instead of a text property, this is 3903 overlay property instead of a text property, this is
3878 already handled in the overlay code.) */ 3904 already handled in the overlay code.) */
3879 if (NILP (overlay) 3905 if (NILP (overlay)
3880 && get_overlay_strings (it, start_charpos)) 3906 && get_overlay_strings (it, it->stop_charpos))
3881 { 3907 {
3882 handled = HANDLED_RECOMPUTE_PROPS; 3908 handled = HANDLED_RECOMPUTE_PROPS;
3883 it->stack[it->sp - 1].display_ellipsis_p = display_ellipsis_p; 3909 it->stack[it->sp - 1].display_ellipsis_p = display_ellipsis_p;
@@ -6200,7 +6226,16 @@ set_iterator_to_next (it, reseat_p)
6200 /* If this is a new paragraph, determine its base 6226 /* If this is a new paragraph, determine its base
6201 direction (a.k.a. its base embedding level). */ 6227 direction (a.k.a. its base embedding level). */
6202 if (it->bidi_it.new_paragraph) 6228 if (it->bidi_it.new_paragraph)
6203 bidi_paragraph_init (it->paragraph_embedding, &it->bidi_it); 6229 {
6230 bidi_paragraph_init (it->paragraph_embedding, &it->bidi_it);
6231 if (it->glyph_row)
6232 {
6233 if (it->bidi_it.paragraph_dir == R2L)
6234 it->glyph_row->reversed_p = 1;
6235 else
6236 it->glyph_row->reversed_p = 0;
6237 }
6238 }
6204 bidi_get_next_char_visually (&it->bidi_it); 6239 bidi_get_next_char_visually (&it->bidi_it);
6205 IT_BYTEPOS (*it) = it->bidi_it.bytepos; 6240 IT_BYTEPOS (*it) = it->bidi_it.bytepos;
6206 IT_CHARPOS (*it) = it->bidi_it.charpos; 6241 IT_CHARPOS (*it) = it->bidi_it.charpos;
@@ -6663,8 +6698,13 @@ next_element_from_buffer (it)
6663 bidi_paragraph_init (it->paragraph_embedding, &it->bidi_it); 6698 bidi_paragraph_init (it->paragraph_embedding, &it->bidi_it);
6664 /* If the paragraph base direction is R2L, its glyphs should 6699 /* If the paragraph base direction is R2L, its glyphs should
6665 be reversed. */ 6700 be reversed. */
6666 if (it->glyph_row && (it->bidi_it.level_stack[0].level & 1) != 0) 6701 if (it->glyph_row)
6667 it->glyph_row->reversed_p = 1; 6702 {
6703 if (it->bidi_it.paragraph_dir == R2L)
6704 it->glyph_row->reversed_p = 1;
6705 else
6706 it->glyph_row->reversed_p = 0;
6707 }
6668 bidi_get_next_char_visually (&it->bidi_it); 6708 bidi_get_next_char_visually (&it->bidi_it);
6669 } 6709 }
6670 else 6710 else
@@ -6679,8 +6719,13 @@ next_element_from_buffer (it)
6679 it->bidi_it.charpos = IT_CHARPOS (*it); 6719 it->bidi_it.charpos = IT_CHARPOS (*it);
6680 it->bidi_it.bytepos = IT_BYTEPOS (*it); 6720 it->bidi_it.bytepos = IT_BYTEPOS (*it);
6681 bidi_paragraph_init (it->paragraph_embedding, &it->bidi_it); 6721 bidi_paragraph_init (it->paragraph_embedding, &it->bidi_it);
6682 if (it->glyph_row && (it->bidi_it.level_stack[0].level & 1) != 0) 6722 if (it->glyph_row)
6683 it->glyph_row->reversed_p = 1; 6723 {
6724 if (it->bidi_it.paragraph_dir == R2L)
6725 it->glyph_row->reversed_p = 1;
6726 else
6727 it->glyph_row->reversed_p = 0;
6728 }
6684 do 6729 do
6685 { 6730 {
6686 /* Now return to buffer position where we were asked to 6731 /* Now return to buffer position where we were asked to
@@ -17028,10 +17073,6 @@ display_line (it)
17028 row->displays_text_p = 1; 17073 row->displays_text_p = 1;
17029 row->starts_in_middle_of_char_p = it->starts_in_middle_of_char_p; 17074 row->starts_in_middle_of_char_p = it->starts_in_middle_of_char_p;
17030 it->starts_in_middle_of_char_p = 0; 17075 it->starts_in_middle_of_char_p = 0;
17031 /* If the paragraph base direction is R2L, its glyphs should be
17032 reversed. */
17033 if (it->bidi_p && (it->bidi_it.level_stack[0].level & 1) != 0)
17034 row->reversed_p = 1;
17035 17076
17036 /* Arrange the overlays nicely for our purposes. Usually, we call 17077 /* Arrange the overlays nicely for our purposes. Usually, we call
17037 display_line on only one line at a time, in which case this 17078 display_line on only one line at a time, in which case this
@@ -17566,6 +17607,10 @@ display_line (it)
17566 it->current_y += row->height; 17607 it->current_y += row->height;
17567 ++it->vpos; 17608 ++it->vpos;
17568 ++it->glyph_row; 17609 ++it->glyph_row;
17610 /* The next row should use same value of the reversed_p flag as this
17611 one. set_iterator_to_next decides when it's a new paragraph and
17612 recomputes the value of the flag accordingly. */
17613 it->glyph_row->reversed_p = row->reversed_p;
17569 it->start = row_end; 17614 it->start = row_end;
17570 return row->displays_text_p; 17615 return row->displays_text_p;
17571} 17616}