From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Line wrap reconsidered Date: Sun, 31 May 2020 20:55:19 +0300 Message-ID: <83pnakj8fs.fsf@gnu.org> References: <92FF4412-04FB-4521-B6CE-52B08526E4E5@gmail.com> <878shfsq35.fsf@gnus.org> <83imgivjak.fsf@gnu.org> <83lfletr03.fsf@gnu.org> <4895C6EE-5E1F-44BF-93C1-CC5F7C096F73@gmail.com> <9766BA3D-B8F9-456B-9F59-60D21B86E390@gmail.com> <83sgfls2ul.fsf@gnu.org> <83v9kgq6jy.fsf@gnu.org> <5E75D1E2-8BFF-45DA-A643-40DBD5784508@gmail.com> <83r1v3qlel.fsf@gnu.org> <83blm6lzj3.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="126722"; mail-complaints-to="usenet@ciao.gmane.io" Cc: larsi@gnus.org, emacs-devel@gnu.org To: Yuan Fu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun May 31 19:56:52 2020 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jfSCa-000Wti-8W for ged-emacs-devel@m.gmane-mx.org; Sun, 31 May 2020 19:56:52 +0200 Original-Received: from localhost ([::1]:48482 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jfSCZ-0006fE-95 for ged-emacs-devel@m.gmane-mx.org; Sun, 31 May 2020 13:56:51 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:36630) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jfSB6-00050k-VX for emacs-devel@gnu.org; Sun, 31 May 2020 13:55:21 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:57921) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jfSB6-0007sy-K1; Sun, 31 May 2020 13:55:20 -0400 Original-Received: from [176.228.60.248] (port=1135 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jfSB6-0005ki-35; Sun, 31 May 2020 13:55:20 -0400 In-Reply-To: (message from Yuan Fu on Sun, 31 May 2020 13:39:56 -0400) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:251690 Archived-At: > From: Yuan Fu > Date: Sun, 31 May 2020 13:39:56 -0400 > Cc: Lars Ingebrigtsen , > emacs-devel > > >> 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.