From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Yuan Fu Newsgroups: gmane.emacs.devel Subject: Re: Line wrap reconsidered Date: Thu, 28 May 2020 16:42:33 -0400 Message-ID: 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> Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.80.23.2.2\)) Content-Type: multipart/alternative; boundary="Apple-Mail=_AFBB418C-583D-4618-9989-A0469592CF8B" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="96602"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Lars Ingebrigtsen , emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu May 28 22:44:03 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 1jePNj-000P0H-0N for ged-emacs-devel@m.gmane-mx.org; Thu, 28 May 2020 22:44:03 +0200 Original-Received: from localhost ([::1]:34354 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jePNh-0002Dr-VI for ged-emacs-devel@m.gmane-mx.org; Thu, 28 May 2020 16:44:01 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:58396) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jePMM-00013T-6v for emacs-devel@gnu.org; Thu, 28 May 2020 16:42:38 -0400 Original-Received: from mail-qk1-x729.google.com ([2607:f8b0:4864:20::729]:46937) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jePML-0002Ds-12; Thu, 28 May 2020 16:42:37 -0400 Original-Received: by mail-qk1-x729.google.com with SMTP id c12so209828qkk.13; Thu, 28 May 2020 13:42:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:message-id:mime-version:subject:date:in-reply-to:cc:to :references; bh=xkfOU2Oi2AN3t/dQ9N+cHKyitQsvlt+/vLGZWKh+w18=; b=LKEzECKRT1bRb5seX5+3yPir8bIFbvOOFxaqfkii6lxm64gxFKe60Qaj2cOGAdfLh9 5HtoqWNXqICOn6FD3TuXUsV4Zv2DNjXJyhaQkeeoWwT6AaTyIEl2UMFaUU+HUEfnWWCx RxOQySK4+ZQLO87b+IWPg5qhp22fBe3YnXbvn55nX9USMMY4SBaQULv0ssQ8nBqlpg6h tKdrjrjUqCVP6h4rGpGTIUXTq0ZnjCV3UTbr3jBpmLSgUS4r8i4GxbU4gwjItMsiyx/z peetCVtyYO9amM8i7EnpKU/iEHYC7etafYFVoUh+AkHMv1AkBCY/d59ffk7w0J9OD85E vzWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:mime-version:subject:date :in-reply-to:cc:to:references; bh=xkfOU2Oi2AN3t/dQ9N+cHKyitQsvlt+/vLGZWKh+w18=; b=b83qh8J09QdY1ni0CUckY1f5d6ET5Ql8kfAVCofGJ2DDxQLhb0d2ANzzrrdzDQY19F h0ld0a9AI6sFCuST2rRdYOcFTUGTSXJVq9WFUt5EaWGjhJJOpCemJwWhTDBmlv+QkT4B uR7m0kgrJv8TCztvhcjJxVQIRH83nWhA1nhKVGCxLixyGyD85oEJEqdJCSYooEuKFuGF htVCELcbsAtX2P/U8eci4PIHWu74gFD2gzeOsqGqC2r6KCDAtIIZWCUtGgvpLpPqA05O c7kAiKstraTp+HPvw0D3qiFF3IvhFGXvaUhAOc7yhr7dPZ34CMAjGYsnnc4avOyN4vZL x+bg== X-Gm-Message-State: AOAM532c7nClGCkGF6uo8wShss0vbhmQ70Y8eMbGIk+FQ+CZbMJDt07c z2tEjuIX2xicUSLtsG/x0eLhe0qrOcjGFg== X-Google-Smtp-Source: ABdhPJzou2LL55dZvzDMq2nnZvAOtgZVfpO6fXa5S3QP86C4xbRGAjpGjvAr5biFu2mYaaXvS1qDqg== X-Received: by 2002:a37:a7c5:: with SMTP id q188mr4577254qke.384.1590698555067; Thu, 28 May 2020 13:42:35 -0700 (PDT) Original-Received: from [192.168.1.10] (c-174-60-229-153.hsd1.pa.comcast.net. [174.60.229.153]) by smtp.gmail.com with ESMTPSA id q32sm4693690qtf.36.2020.05.28.13.42.34 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 May 2020 13:42:34 -0700 (PDT) In-Reply-To: <5E75D1E2-8BFF-45DA-A643-40DBD5784508@gmail.com> X-Mailer: Apple Mail (2.3608.80.23.2.2) Received-SPF: pass client-ip=2607:f8b0:4864:20::729; envelope-from=casouri@gmail.com; helo=mail-qk1-x729.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action 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:251578 Archived-At: --Apple-Mail=_AFBB418C-583D-4618-9989-A0469592CF8B Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 >>=20 >>> Although the original code only has one checker (IS_WHITESPACE), it = serves a dual purpose: it is used to determine if we can wrap = after=E2=80=94whitespace and tab allow wrapping after; it is also used = to determine if we can wrap before=E2=80=94they don=E2=80=99t allow = wrapping before (otherwise you see whitespace and tabs on the beginning = of the next line). >>=20 >> That is true. I suggested to have a single function so that you = could >> in that single function perform the same test, just using two >> different categories. then you could basically keep the rest of the >> logic intact. If that is somehow not possible, can you explain why? >=20 > IT_DISPLAYING_WHITESPACE works because it was only check for two types = of characters. Now we have four. A Boolean function can=E2=80=99t return = more than two possibilities. Two Boolean functions combined can express = four possibilities. >=20 > | Type | wrap_before? | wrap_after? | > |-----------+--------------+-------------| > | space/tab | no | yes | > | other | yes | no | >=20 > | Type | wrap_before? | wrap_after? | > |-----------+--------------+-------------| > | space/tab | no | yes | > | CJK | yes | yes | > | other | yes | no | > | ?? | no | no | I finally wrapped my head around this, yes I can make it one function = which returns a enum. If that=E2=80=99s what you mean. In the meantime = I=E2=80=99m still reading the unicode document, the unicode algorithm = might require much more machinery. For one, the wrap-ability doesn=E2=80=99= t only depend of the immediate characters anymore, e.g., a character = before the character before could affect this character=E2=80=99s = wrap-ability. Yuan --Apple-Mail=_AFBB418C-583D-4618-9989-A0469592CF8B Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8


Although the original code only has one checker = (IS_WHITESPACE), it serves a dual purpose: it is used to determine if we = can wrap after=E2=80=94whitespace and tab allow wrapping after; it is = also used to determine if we can wrap before=E2=80=94they don=E2=80=99t = allow wrapping before (otherwise you see whitespace and tabs on the = beginning of the next line).

That is true.  I suggested to have a single function so = that you could
in that single function perform the same = test, just using two
different categories.  then you = could basically keep the rest of the
logic intact. =  If that is somehow not possible, can you explain why?

IT_DISPLAYING_WHITESPACE works because it was only check for = two types of characters. Now we have four. A Boolean function can=E2=80=99= t return more than two possibilities. Two Boolean functions combined can = express four possibilities.

| Type      | wrap_before? | = wrap_after? |
|-----------+--------------+-------------|
| space/tab | no =           | yes =         |
| other     | yes =          | no =          |

| Type      | wrap_before? | = wrap_after? |
|-----------+--------------+-------------|
| space/tab | no =           | yes =         |
| CJK       | yes =          | yes =         |
| other     | yes =          | no =          |
| ??        | no =           | no =          |

I finally wrapped my head around this, yes I can make it one = function which returns a enum. If that=E2=80=99s what you mean. In the = meantime I=E2=80=99m still reading the unicode document, the unicode = algorithm might require much more machinery. For one, the wrap-ability = doesn=E2=80=99t only depend of the immediate characters anymore, e.g., a = character before the character before could affect this character=E2=80=99= s wrap-ability.

Yuan


= --Apple-Mail=_AFBB418C-583D-4618-9989-A0469592CF8B--