From 398ad62a4986e426aa665010b69319fec9203430 Mon Sep 17 00:00:00 2001 From: Khaled Hosny Date: Sat, 5 Jan 2019 22:54:48 +0200 Subject: [PATCH] We need the bidi level not the paragraph direction --- src/composite.c | 16 ++++++++-------- src/composite.h | 2 +- src/xdisp.c | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/composite.c b/src/composite.c index 77bb79a0cfe..28501e47571 100644 --- a/src/composite.c +++ b/src/composite.c @@ -1167,8 +1167,8 @@ composition_compute_stop_pos (struct composition_it *cmp_it, ptrdiff_t charpos, characters to be composed. FACE, if non-NULL, is a base face of the character. If STRING is not nil, it is a string containing the character to check, and CHARPOS and BYTEPOS are indices in the - string. In that case, FACE must not be NULL. PDIR is the base - direction of the current paragraph, and is used to calculate the + string. In that case, FACE must not be NULL. BIDI_LEVEL is the bidi + embedding level of the current paragraph, and is used to calculate the direction argument to pass to the font shaper. If the character is composed, setup members of CMP_IT (id, nglyphs, @@ -1178,7 +1178,7 @@ composition_compute_stop_pos (struct composition_it *cmp_it, ptrdiff_t charpos, bool composition_reseat_it (struct composition_it *cmp_it, ptrdiff_t charpos, ptrdiff_t bytepos, ptrdiff_t endpos, struct window *w, - bidi_dir_t pdir, struct face *face, Lisp_Object string) + signed char bidi_level, struct face *face, Lisp_Object string) { if (cmp_it->ch == -2) { @@ -1215,9 +1215,9 @@ composition_reseat_it (struct composition_it *cmp_it, ptrdiff_t charpos, continue; if (charpos < endpos) { - if (pdir == L2R) + if ((bidi_level & 1) == 0) direction = QL2R; - else if (pdir == R2L) + else direction = QR2L; for (; CONSP (val); val = XCDR (val)) { @@ -1252,10 +1252,10 @@ composition_reseat_it (struct composition_it *cmp_it, ptrdiff_t charpos, else bpos = CHAR_TO_BYTE (cpos); } - if (pdir == L2R) - direction = QR2L; - else if (pdir == R2L) + if ((bidi_level & 1) == 0) direction = QL2R; + else + direction = QR2L; lgstring = autocmp_chars (elt, cpos, bpos, charpos + 1, w, face, string, direction); if (! composition_gstring_p (lgstring) diff --git a/src/composite.h b/src/composite.h index 44f7ab7f616..8ee18cd9eea 100644 --- a/src/composite.h +++ b/src/composite.h @@ -322,7 +322,7 @@ extern void composition_compute_stop_pos (struct composition_it *, Lisp_Object); extern bool composition_reseat_it (struct composition_it *, ptrdiff_t, ptrdiff_t, ptrdiff_t, struct window *, - bidi_dir_t, struct face *, Lisp_Object); + signed char, struct face *, Lisp_Object); extern int composition_update_it (struct composition_it *, ptrdiff_t, ptrdiff_t, Lisp_Object); diff --git a/src/xdisp.c b/src/xdisp.c index 413d64f80c7..665ab2e583f 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -6906,7 +6906,7 @@ static next_element_function const get_next_element[NUM_IT_METHODS] = || ((IT)->cmp_it.stop_pos == (CHARPOS) \ && composition_reseat_it (&(IT)->cmp_it, CHARPOS, BYTEPOS, \ END_CHARPOS, (IT)->w, \ - (IT)->bidi_it.paragraph_dir, \ + (IT)->bidi_it.resolved_level, \ FACE_FROM_ID_OR_NULL ((IT)->f, \ (IT)->face_id), \ (IT)->string))) -- 2.39.2