aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Zaretskii2014-10-14 16:32:53 +0300
committerEli Zaretskii2014-10-14 16:32:53 +0300
commitb7e629271273fe83028161a3dea1b1bc975d75ca (patch)
tree5ffbbc92bd2ffc6df09b15f932328cc519bd1728
parent3fe73df071b1d354c7e35f30a105c3133c9c38a4 (diff)
downloademacs-b7e629271273fe83028161a3dea1b1bc975d75ca.tar.gz
emacs-b7e629271273fe83028161a3dea1b1bc975d75ca.zip
Fix resolution of neutrals that came out of the cache.
-rw-r--r--src/bidi.c26
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)
2439 eassert (bpa_stack[sp].open_bracket_pos == tem_it.charpos); 2439 eassert (bpa_stack[sp].open_bracket_pos == tem_it.charpos);
2440#endif 2440#endif
2441 tem_it.type = type; 2441 tem_it.type = type;
2442 tem_it.bracket_resolved = 1;
2442 bidi_cache_iterator_state (&tem_it, 0, 0); 2443 bidi_cache_iterator_state (&tem_it, 0, 0);
2444 /* Mark as resolved the unmatched brackets we are
2445 about to pop from the stack. */
2446 while (bpa_sp > sp)
2447 {
2448 bidi_cache_fetch_state
2449 (bpa_stack[bpa_sp].open_bracket_idx, &tem_it);
2450#ifdef ENABLE_CHECKING
2451 eassert (bpa_stack[bpa_sp].open_bracket_pos
2452 == tem_it.charpos);
2453#endif
2454 tem_it.bracket_resolved = 1;
2455 bidi_cache_iterator_state (&tem_it, 0, 0);
2456 bpa_sp--;
2457 }
2458 /* Pop the BPA stack. */
2443 bpa_sp = sp - 1; 2459 bpa_sp = sp - 1;
2444 } 2460 }
2445 bidi_it->bracket_resolved = 1; 2461 bidi_it->bracket_resolved = 1;
@@ -2474,9 +2490,6 @@ bidi_resolve_bracket_pairs (struct bidi_it *bidi_it)
2474 } 2490 }
2475 for (sp = bpa_sp; sp >= 0; sp--) 2491 for (sp = bpa_sp; sp >= 0; sp--)
2476 bpa_stack[sp].flags |= flag; 2492 bpa_stack[sp].flags |= flag;
2477 /* FIXME: Pay attention to types that can be
2478 next_for_neutral, and when found, update cached
2479 states for which it is relevant. */
2480 } 2493 }
2481 old_sidx = bidi_it->stack_idx; 2494 old_sidx = bidi_it->stack_idx;
2482 type = bidi_resolve_weak (bidi_it); 2495 type = bidi_resolve_weak (bidi_it);
@@ -2566,9 +2579,16 @@ bidi_resolve_neutral (struct bidi_it *bidi_it)
2566 2579
2567 if (bidi_cache_idx > bidi_cache_start && !bidi_it->first_elt) 2580 if (bidi_cache_idx > bidi_cache_start && !bidi_it->first_elt)
2568 { 2581 {
2582 struct bidi_it tem_it;
2583
2569 if (bidi_it->nchars <= 0) 2584 if (bidi_it->nchars <= 0)
2570 emacs_abort (); 2585 emacs_abort ();
2586 bidi_copy_it (&tem_it, bidi_it);
2571 type = bidi_cache_find (bidi_it->charpos + bidi_it->nchars, 1, bidi_it); 2587 type = bidi_cache_find (bidi_it->charpos + bidi_it->nchars, 1, bidi_it);
2588 if (type != UNKNOWN_BT
2589 && (tem_it.type == STRONG_R || tem_it.type == STRONG_L
2590 || tem_it.type == WEAK_EN || tem_it.type == WEAK_AN))
2591 bidi_remember_char (&bidi_it->prev_for_neutral, &tem_it, 1);
2572 } 2592 }
2573 if (type == UNKNOWN_BT) 2593 if (type == UNKNOWN_BT)
2574 type = bidi_resolve_brackets (bidi_it); 2594 type = bidi_resolve_brackets (bidi_it);