On May 31, 2020, at 1:55 PM, Eli Zaretskii < eliz@gnu.org> wrote:
From: Yuan Fu <casouri@gmail.com> Date: Sun, 31 May 2020 13:39:56 -0400 Cc: Lars Ingebrigtsen <larsi@gnus.org>, emacs-devel <emacs-devel@gnu.org>
I think I did jus that, i.e., if (may_wrap && char_can_wrap_before(it)).
Fundamentally, yes. But having a complex condition
if (FOO && BAR)
makes the code harder to read and understand, and thus makes logical errors easier, than a simple condition like
if (FOOBAR == some_value)
In principle, yes, but I doubt the current logic can be simplified. Do you have some concrete example?
It was a suggestion. Maybe it can't be done. Let's see the code, and then we could try simplifying the logic. The issue here is that IT_DISPLAYING_WHITESPACE is used in many places, and it is not easy to understand how to map that to 2 different conditions. Making just one condition eliminates that problem and lowers the probability of introducing bugs.
Aye. If bidi-paragraph-direction is right-to-left, then yes, they are reversed. But not if the paragraph direction is left-to-right.
Then does bidi.c handle word wrapping when bidi-paragraph-direction is right-to-left? Paragraph 3.4 mentioned that “The accumulated widths of those glyphs (in logical order) are used to determine line breaks.”
No, it's in xdisp.c, the code that you are changing. bidi.c just makes it so that the "next" character is the next one in the visual order, i.e. it replaces a simple increment of buffer position.
Thanks for your patience. Then how does xdisp.c (or bidi.c) know how much space to leave at the left edge, when the paragraph is right-to-left? For example, in the figure below, how does Emacs determine how much space to leave at the place where I marked with yellow highlighter? I assume the iterater starts from the left edge of the first line and bidi gives it a line with a white space stretch ? The comment says “On graphics terminals, there's a single stretch glyph of a suitably computed width.” Or does the iterator go from right to left?
Yuan
|