Refactoring with bidi_fetch_char tested and debugged.
src/bidi.c (bidi_fetch_char): Accept also character position corresponding to BYTEPOS. All callers changed. (bidi_cache_iterator_state, bidi_resolve_explicit_1) (bidi_resolve_explicit, bidi_resolve_weak) (bidi_level_of_next_char, bidi_move_to_visually_next): Abort if bidi_it->nchars is non-positive. (bidi_level_of_next_char): Don't try to lookup the cache for the next/previous character if nothing is cached there yet, or if we were just reseat()'ed to a new position. (bidi_paragraph_init, bidi_resolve_explicit_1) (bidi_level_of_next_char): Fix arguments in the calls to bidi_fetch_char.
Showing with 71 additions and 30 deletions