emacs-devel
[Top][All Lists]
Advanced

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

Re: Line wrap reconsidered


From: Eli Zaretskii
Subject: Re: Line wrap reconsidered
Date: Sun, 31 May 2020 20:55:19 +0300

> 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.

> > 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.



reply via email to

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