diff options
author | Eli Zaretskii <eliz@gnu.org> | 2014-10-14 16:32:53 +0300 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2014-10-14 16:32:53 +0300 |
commit | b7e629271273fe83028161a3dea1b1bc975d75ca (patch) | |
tree | 5ffbbc92bd2ffc6df09b15f932328cc519bd1728 /src/bidi.c | |
parent | 3fe73df071b1d354c7e35f30a105c3133c9c38a4 (diff) | |
download | emacs-b7e629271273fe83028161a3dea1b1bc975d75ca.tar.gz |
Fix resolution of neutrals that came out of the cache.
Diffstat (limited to 'src/bidi.c')
-rw-r--r-- | src/bidi.c | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/src/bidi.c b/src/bidi.c index fc47a583cfe..c324914d2f8 100644 --- a/src/bidi.c +++ b/src/bidi.c @@ -2439,7 +2439,23 @@ bidi_resolve_bracket_pairs (struct bidi_it *bidi_it) eassert (bpa_stack[sp].open_bracket_pos == tem_it.charpos); #endif tem_it.type = type; + tem_it.bracket_resolved = 1; bidi_cache_iterator_state (&tem_it, 0, 0); + /* Mark as resolved the unmatched brackets we are + about to pop from the stack. */ + while (bpa_sp > sp) + { + bidi_cache_fetch_state + (bpa_stack[bpa_sp].open_bracket_idx, &tem_it); +#ifdef ENABLE_CHECKING + eassert (bpa_stack[bpa_sp].open_bracket_pos + == tem_it.charpos); +#endif + tem_it.bracket_resolved = 1; + bidi_cache_iterator_state (&tem_it, 0, 0); + bpa_sp--; + } + /* Pop the BPA stack. */ bpa_sp = sp - 1; } bidi_it->bracket_resolved = 1; @@ -2474,9 +2490,6 @@ bidi_resolve_bracket_pairs (struct bidi_it *bidi_it) } for (sp = bpa_sp; sp >= 0; sp--) bpa_stack[sp].flags |= flag; - /* FIXME: Pay attention to types that can be - next_for_neutral, and when found, update cached - states for which it is relevant. */ } old_sidx = bidi_it->stack_idx; type = bidi_resolve_weak (bidi_it); @@ -2566,9 +2579,16 @@ bidi_resolve_neutral (struct bidi_it *bidi_it) if (bidi_cache_idx > bidi_cache_start && !bidi_it->first_elt) { + struct bidi_it tem_it; + if (bidi_it->nchars <= 0) emacs_abort (); + bidi_copy_it (&tem_it, bidi_it); type = bidi_cache_find (bidi_it->charpos + bidi_it->nchars, 1, bidi_it); + if (type != UNKNOWN_BT + && (tem_it.type == STRONG_R || tem_it.type == STRONG_L + || tem_it.type == WEAK_EN || tem_it.type == WEAK_AN)) + bidi_remember_char (&bidi_it->prev_for_neutral, &tem_it, 1); } if (type == UNKNOWN_BT) type = bidi_resolve_brackets (bidi_it); |