[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Line wrap reconsidered

From: Yuan Fu
Subject: Re: Line wrap reconsidered
Date: Sun, 12 Jul 2020 15:28:18 -0400

On Jul 12, 2020, at 2:27 PM, Eli Zaretskii <eliz@gnu.org> wrote:

From: Yuan Fu <casouri@gmail.com>
Date: Sun, 12 Jul 2020 13:25:03 -0400
Cc: Lars Ingebrigtsen <larsi@gnus.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)
    kinsoku_can_wrap = IT_CHAR_HAS_CATEGORY (it, LINE_BREAKABLE)

  /* 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?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]