aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2010-01-01 06:35:03 -0500
committerEli Zaretskii2010-01-01 06:35:03 -0500
commite5a2fec7b4a8c1435d74d50796259b3e4b895cd4 (patch)
tree6ffd4b7aa57ad890f6971451dbb4c6d4eb712567 /src
parentc143c213258b4dc980dab0629e571ff0c227fc34 (diff)
downloademacs-e5a2fec7b4a8c1435d74d50796259b3e4b895cd4.tar.gz
emacs-e5a2fec7b4a8c1435d74d50796259b3e4b895cd4.zip
Retrospective commit from 2009-10-10.
Continue working on set_cursor_from_row. Disable redisplay optimizations that interfere with R2L glyph rows. Misc cleanups in bidi.c. xdisp.c (set_cursor_from_row): Skip over glyphs near end of row with integer OBJECT even if their CHARPOS is zero. bidi.c (bidi_cache_iterator_state): Don't cache NEW_PARAGRAPH. Abort if someone tries to add a cached state whose position is not the immediate successor to that of the last cached state. (bidi_paragraph_init): Don't bail out too early after a reseat. xdisp.c (text_outside_line_unchanged_p, try_window_id): Disable optimizations if we are reordering bidirectional text and the paragraph direction can be affected by the change.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog.bidi16
-rw-r--r--src/bidi.c13
-rw-r--r--src/xdisp.c29
3 files changed, 54 insertions, 4 deletions
diff --git a/src/ChangeLog.bidi b/src/ChangeLog.bidi
index cb44f665ad4..ae5807ce13a 100644
--- a/src/ChangeLog.bidi
+++ b/src/ChangeLog.bidi
@@ -1,3 +1,19 @@
12009-10-10 Eli Zaretskii <eliz@gnu.org>
2
3 * xdisp.c (set_cursor_from_row): Skip over glyphs near end of row
4 with integer OBJECT even if their CHARPOS is zero.
5
6 * bidi.c (bidi_cache_iterator_state): Don't cache NEW_PARAGRAPH.
7 Abort if someone tries to add a cached state whose position is not
8 the immediate successor to that of the last cached state.
9 (bidi_paragraph_init): Don't bail out too early after a reseat.
10
112009-10-09 Eli Zaretskii <eliz@gnu.org>
12
13 * xdisp.c (text_outside_line_unchanged_p, try_window_id): Disable
14 optimizations if we are reordering bidirectional text and the
15 paragraph direction can be affected by the change.
16
12009-10-08 Eli Zaretskii <eliz@gnu.org> 172009-10-08 Eli Zaretskii <eliz@gnu.org>
2 18
3 * xdisp.c (string_buffer_position_lim): New function. 19 * xdisp.c (string_buffer_position_lim): New function.
diff --git a/src/bidi.c b/src/bidi.c
index 840eb6a81b6..f6ca8cd20e9 100644
--- a/src/bidi.c
+++ b/src/bidi.c
@@ -531,6 +531,7 @@ bidi_copy_it (struct bidi_it *to, struct bidi_it *from)
531 531
532 /* Copy everything except the level stack. */ 532 /* Copy everything except the level stack. */
533 memcpy (to, from, ((int)&((struct bidi_it *)0)->level_stack[0])); 533 memcpy (to, from, ((int)&((struct bidi_it *)0)->level_stack[0]));
534 /* Don't copy FIRST_ELT flag. */
534 to->first_elt = save_first_elt; 535 to->first_elt = save_first_elt;
535 if (to->first_elt != 0 && to->first_elt != 1) 536 if (to->first_elt != 0 && to->first_elt != 1)
536 to->first_elt = 0; 537 to->first_elt = 0;
@@ -675,11 +676,17 @@ bidi_cache_iterator_state (struct bidi_it *bidi_it, int resolved)
675 if (idx < 0) 676 if (idx < 0)
676 { 677 {
677 idx = bidi_cache_idx; 678 idx = bidi_cache_idx;
679 /* Don't overrun the cache limit. */
678 if (idx > sizeof (bidi_cache) / sizeof (bidi_cache[0]) - 1) 680 if (idx > sizeof (bidi_cache) / sizeof (bidi_cache[0]) - 1)
679 abort (); 681 abort ();
682 /* Don't violate cache integrity: character positions should
683 correspond to cache positions 1:1. */
684 if (idx > 0 && bidi_it->charpos != bidi_cache[idx - 1].charpos + 1)
685 abort ();
680 bidi_copy_it (&bidi_cache[idx], bidi_it); 686 bidi_copy_it (&bidi_cache[idx], bidi_it);
681 if (!resolved) 687 if (!resolved)
682 bidi_cache[idx].resolved_level = -1; 688 bidi_cache[idx].resolved_level = -1;
689 bidi_cache[idx].new_paragraph = 0;
683 } 690 }
684 else 691 else
685 { 692 {
@@ -869,8 +876,10 @@ bidi_paragraph_init (bidi_dir_t dir, struct bidi_it *bidi_it)
869 876
870 /* If we are inside a paragraph separator, we are just waiting 877 /* If we are inside a paragraph separator, we are just waiting
871 for the separator to be exhausted; use the previous paragraph 878 for the separator to be exhausted; use the previous paragraph
872 direction. */ 879 direction. But don't do that if we have been just reseated,
873 if (bidi_it->charpos < bidi_it->separator_limit) 880 because we need to reinitialize below in that case. */
881 if (!bidi_it->first_elt
882 && bidi_it->charpos < bidi_it->separator_limit)
874 return; 883 return;
875 884
876 /* If we are on a newline, get past it to where the next 885 /* If we are on a newline, get past it to where the next
diff --git a/src/xdisp.c b/src/xdisp.c
index c9f93889b30..581a7a0faa2 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -11147,6 +11147,17 @@ text_outside_line_unchanged_p (w, start, end)
11147 && overlay_touches_p (Z - end)) 11147 && overlay_touches_p (Z - end))
11148 unchanged_p = 0; 11148 unchanged_p = 0;
11149 } 11149 }
11150
11151 /* Under bidi reordering, adding or deleting a character in the
11152 beginning of a paragraph, before the first strong directional
11153 character, can change the base direction of the paragraph (unless
11154 the buffer specifies a fixed paragraph direction), which will
11155 require to redisplay the whole paragraph. It might be worthwhile
11156 to find the paragraph limits and widen the range of redisplayed
11157 lines to that, but for now just give up this optimization. */
11158 if (!NILP (XBUFFER (w->buffer)->bidi_display_reordering)
11159 && NILP (XBUFFER (w->buffer)->paragraph_direction))
11160 unchanged_p = 0;
11150 } 11161 }
11151 11162
11152 return unchanged_p; 11163 return unchanged_p;
@@ -12468,7 +12479,9 @@ set_cursor_from_row (w, row, matrix, delta, delta_bytes, dy, dvpos)
12468 } 12479 }
12469 while (end > glyph 12480 while (end > glyph
12470 && INTEGERP ((end - 1)->object) 12481 && INTEGERP ((end - 1)->object)
12471 && (end - 1)->charpos < 0) 12482 /* CHARPOS is zero for blanks inserted by
12483 extend_face_to_end_of_line. */
12484 && (end - 1)->charpos <= 0)
12472 --end; 12485 --end;
12473 glyph_before = glyph - 1; 12486 glyph_before = glyph - 1;
12474 glyph_after = end; 12487 glyph_after = end;
@@ -12500,7 +12513,7 @@ set_cursor_from_row (w, row, matrix, delta, delta_bytes, dy, dvpos)
12500 cursor_x = x; 12513 cursor_x = x;
12501 while (end < glyph 12514 while (end < glyph
12502 && INTEGERP (end->object) 12515 && INTEGERP (end->object)
12503 && end->charpos < 0) 12516 && end->charpos <= 0)
12504 ++end; 12517 ++end;
12505 glyph_before = glyph + 1; 12518 glyph_before = glyph + 1;
12506 glyph_after = end; 12519 glyph_after = end;
@@ -15203,6 +15216,18 @@ try_window_id (w)
15203 if (!NILP (XBUFFER (w->buffer)->word_wrap)) 15216 if (!NILP (XBUFFER (w->buffer)->word_wrap))
15204 GIVE_UP (21); 15217 GIVE_UP (21);
15205 15218
15219 /* Under bidi reordering, adding or deleting a character in the
15220 beginning of a paragraph, before the first strong directional
15221 character, can change the base direction of the paragraph (unless
15222 the buffer specifies a fixed paragraph direction), which will
15223 require to redisplay the whole paragraph. It might be worthwhile
15224 to find the paragraph limits and widen the range of redisplayed
15225 lines to that, but for now just give up this optimization and
15226 redisplay from scratch. */
15227 if (!NILP (XBUFFER (w->buffer)->bidi_display_reordering)
15228 && NILP (XBUFFER (w->buffer)->paragraph_direction))
15229 GIVE_UP (22);
15230
15206 /* Make sure beg_unchanged and end_unchanged are up to date. Do it 15231 /* Make sure beg_unchanged and end_unchanged are up to date. Do it
15207 only if buffer has really changed. The reason is that the gap is 15232 only if buffer has really changed. The reason is that the gap is
15208 initially at Z for freshly visited files. The code below would 15233 initially at Z for freshly visited files. The code below would