aboutsummaryrefslogtreecommitdiffstats
path: root/src/bidi.c
diff options
context:
space:
mode:
authorEli Zaretskii2011-06-25 14:44:30 +0300
committerEli Zaretskii2011-06-25 14:44:30 +0300
commit0c22566f00ee467af8d41ef7dc9f18c3b66630c5 (patch)
tree7db72a0297d9f21e0582d94286c21cad2c64dfa9 /src/bidi.c
parent58b9f433ad4a4ea20e0c51997ca8a9aaab79a213 (diff)
downloademacs-0c22566f00ee467af8d41ef7dc9f18c3b66630c5.tar.gz
emacs-0c22566f00ee467af8d41ef7dc9f18c3b66630c5.zip
Set up the bidi iterator for iterating display strings and overlay strings.
Not tested yet, just compiled. src/xdisp.c (handle_single_display_spec, next_overlay_string) (get_overlay_strings_1, push_display_prop): Set up the bidi iterator for displaying display or overlay strings. (forward_to_next_line_start): Don't use the shortcut if bidi-iterating. (back_to_previous_visible_line_start): If handle_display_prop pushed the iterator stack, restore the internal state of the bidi iterator by calling bidi_pop_it same number of times. (reseat_at_next_visible_line_start): If ON_NEWLINE_P is non-zero, and we are bidi-iterating, don't decrement the iterator position; instead, set the first_elt flag in the bidi iterator, to produce the same effect. (reseat_1): Remove redundant setting of string_from_display_prop_p. (push_display_prop): xassert that we are iterating a buffer. (push_it, pop_it): Save and restore the state of the bidi iterator. Save and restore the bidi_p flag. (pop_it): Iterate out of display property for string iteration as well. (iterate_out_of_display_property): Support iteration over strings. (handle_single_display_spec): Set up it->bidi_it for iteration over a display string, and call bidi_init_it. src/bidi.c (bidi_cache_start_stack, bidi_push_it): Use IT_STACK_SIZE. src/dispextern.h (struct iterator_stack_entry): New member bidi_p. (struct it): Member bidi_p is now a bit field 1 bit wide.
Diffstat (limited to 'src/bidi.c')
-rw-r--r--src/bidi.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/bidi.c b/src/bidi.c
index b03e93df817..b518dd45782 100644
--- a/src/bidi.c
+++ b/src/bidi.c
@@ -548,11 +548,10 @@ bidi_peek_at_next_level (struct bidi_it *bidi_it)
548/*********************************************************************** 548/***********************************************************************
549 Pushing and popping the bidi iterator state 549 Pushing and popping the bidi iterator state
550 ***********************************************************************/ 550 ***********************************************************************/
551/* 10-slot stack for saving the start of the previous level of the 551/* 5-slot stack for saving the start of the previous level of the
552 cache. xdisp.c maintains a 5-slot cache for its iterator state, 552 cache. xdisp.c maintains a 5-slot stack for its iterator state,
553 and we need just a little bit more. */ 553 and we need the same size of our stack. */
554#define CACHE_STACK_SIZE 10 554static int bidi_cache_start_stack[IT_STACK_SIZE];
555static int bidi_cache_start_stack[CACHE_STACK_SIZE];
556static int bidi_cache_sp; 555static int bidi_cache_sp;
557 556
558/* Push the bidi iterator state in preparation for reordering a 557/* Push the bidi iterator state in preparation for reordering a
@@ -569,7 +568,7 @@ bidi_push_it (struct bidi_it *bidi_it)
569 memcpy (&bidi_cache[bidi_cache_idx++], bidi_it, sizeof (struct bidi_it)); 568 memcpy (&bidi_cache[bidi_cache_idx++], bidi_it, sizeof (struct bidi_it));
570 569
571 /* Push the current cache start onto the stack. */ 570 /* Push the current cache start onto the stack. */
572 if (bidi_cache_sp >= CACHE_STACK_SIZE) 571 if (bidi_cache_sp >= IT_STACK_SIZE)
573 abort (); 572 abort ();
574 bidi_cache_start_stack[bidi_cache_sp++] = bidi_cache_start; 573 bidi_cache_start_stack[bidi_cache_sp++] = bidi_cache_start;
575 574