[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, 31 May 2020 13:39:56 -0400 |
> On May 30, 2020, at 2:14 AM, Eli Zaretskii <eliz@gnu.org> wrote:
>
>> From: Yuan Fu <casouri@gmail.com>
>> Date: Fri, 29 May 2020 17:20:21 -0400
>> Cc: Lars Ingebrigtsen <larsi@gnus.org>,
>> emacs-devel@gnu.org
>>
>>> Then you'll need to augment the test
>>>
>>> else if (may_wrap)
>>>
>>> with a test that the current character can be at BOL. Maybe you
>>> should also make may_wrap a tristate instead of just a boolean YES/NO.
>>>
>>
>> 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?
>
>>>> Essentially I want to ask “if may_wrap == true, what does that mean? (In
>>>> bidi context)” Did the character to the left of me (on glass) set it or
>>>> the character to the right of me set it?
>>>
>>> The one to the left. But it is not necessarily the "previous"
>>> character in buffer position order.
>>
>> I see, but then I don’t don’t understand how does the current code work with
>> bidi display. In bidi context, space char can’t appear on the right of the
>> line, which is the beginning of a logic line, right? That requires the logic
>> to reverse. Is there something I’m missing?
>
> I think the cause of the confusion is the "in bidi context" part.
> There are two such "contexts", and they behave differently:
>
> . RTL characters when bidi-paragraph-direction is left-to-right
> . RTL characters when bidi-paragraph-direction is right-to-left
>
> Which one were you talking about? I was talking about the first one.
>
>> Since may_wrap’s meaning is in terms of left and right, it need to be
>> reversed in bidi text, no?
>
> 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.”
>
>> One more question. If I type 123456789... and set bidi-paragraph-direction
>> to ‘right-to-left, it is still 123456789…, just aligned to the right. I
>> expected to see …987654321, that’s what right-to-left mean in Chinese text.
>> Why the order of each character not revered?
>
> Digits and LTR characters (like English text) are rendered
> left-to-right even in RTL paragraphs, so what you see is correct.
> That's why this is called "bidirectional": the direction is not just
> universally right-to-left.
I see, so characters have their inherited order and that never changes, only
paragraphs change orders.
>
>> UAX#9 didn’t say anything helpful.
>
> It does, albeit in a convoluted and hard-to-grasp way. See paragraph
> 3.3.6 there, and then rule L2 in paragraph 3.4, which describes the
> reordering procedure.
Thanks.
Yuan
- Re: Line wrap reconsidered, (continued)
- Re: Line wrap reconsidered, Yuan Fu, 2020/05/26
- Re: Line wrap reconsidered, Eli Zaretskii, 2020/05/27
- Re: Line wrap reconsidered, Yuan Fu, 2020/05/28
- Re: Line wrap reconsidered, Eli Zaretskii, 2020/05/28
- Re: Line wrap reconsidered, Yuan Fu, 2020/05/28
- Re: Line wrap reconsidered, Yuan Fu, 2020/05/28
- Re: Line wrap reconsidered, Eli Zaretskii, 2020/05/29
- Re: Line wrap reconsidered, Eli Zaretskii, 2020/05/29
- Re: Line wrap reconsidered, Yuan Fu, 2020/05/29
- Re: Line wrap reconsidered, Eli Zaretskii, 2020/05/30
- Re: Line wrap reconsidered,
Yuan Fu <=
- Re: Line wrap reconsidered, Eli Zaretskii, 2020/05/31
- Re: Line wrap reconsidered, Yuan Fu, 2020/05/31
- Re: Line wrap reconsidered, Eli Zaretskii, 2020/05/31
- Re: Line wrap reconsidered, Eli Zaretskii, 2020/05/27
Re: Line wrap reconsidered, martin rudalics, 2020/05/26