> On Jul 12, 2020, at 2:27 PM, Eli Zaretskii wrote: > >> From: Yuan Fu >> Date: Sun, 12 Jul 2020 13:25:03 -0400 >> Cc: Lars Ingebrigtsen , >> emacs-devel@gnu.org >> >> I’m having a strange problem that when bidi-paragraph-direction is ‘left-to-right, Arabic characters wraps fine but Hebrew characters doesn’t. Is there anything special about Hebrew (or Arabic)? > > Not enough information. Is this with your changes? Yes, this only happens with my patch. And that what puzzles me. Here I enabled white-space-mode, as you can see, the second line starts with whitespace. That means Emacs cannot find a wrap point in the Hebrew text and thus is not wrapping but simply continuing the Hebrew text. As you might remember, in my patch the function it_can_wrap_after determines if we can set a warp point after a character. xdisp uses this function to determine if we can set a wrap point, then this function must be the culprit. It looks like this: /* Return true if the current character allows wrapping after it. */ static bool char_can_wrap_after (struct it *it) { /* For CJK (LTR) text in RTL paragraph, EOL and BOL are flipped. */ bool kinsoku_can_wrap; if (it->glyph_row && it->glyph_row->reversed_p) kinsoku_can_wrap = IT_CHAR_HAS_CATEGORY (it, LINE_BREAKABLE) && !IT_CHAR_HAS_CATEGORY (it, NOT_AT_BOL); else kinsoku_can_wrap = IT_CHAR_HAS_CATEGORY (it, LINE_BREAKABLE) && !IT_CHAR_HAS_CATEGORY (it, NOT_AT_EOL); /* We used to only check for whitespace characters for wrapping, hence this macro. Obviously you can wrap after a space or tab. */ return (IT_DISPLAYING_WHITESPACE (it) /* || kinsoku_can_wrap */); } Basically, we can wrap if this char is a whitespace character, or kinsoku says this char is wrap-able. Now, if I comment out the kinsoku part (the last line after ||), Hebrew can wrap normally. But the value of kinsoku_can_wrap shouldn’t matter since IT_DISPLAYING_WHITESPACE (it) should short circuit when we are at a whitespace character. Any guess on where could be the problem? Yuan