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: Fri, 19 Jun 2020 13:22:18 -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> <83r1v3qlel.fsf@gnu.org> <83blm6lzj3.fsf@gnu.org> <83pnakj8fs.fsf@gnu.org> <83k10sj60l.fsf@gnu.org> <0B30F8C8-9B8F-4FCB-B9FB-1B5A0E993CDB@gmail.com> <838sgjzij2.fsf@gnu.org> <83sgerxmbs.fsf@gnu.org> Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.80.23.2.2\)) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="19918"; 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 Fri Jun 19 19:33:59 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 1jmKtq-00052p-MF for ged-emacs-devel@m.gmane-mx.org; Fri, 19 Jun 2020 19:33:58 +0200 Original-Received: from localhost ([::1]:45892 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jmKtp-0004TW-Od for ged-emacs-devel@m.gmane-mx.org; Fri, 19 Jun 2020 13:33:57 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:33796) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jmKid-00013f-Rk for emacs-devel@gnu.org; Fri, 19 Jun 2020 13:22:23 -0400 Original-Received: from mail-qk1-x72c.google.com ([2607:f8b0:4864:20::72c]:34980) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jmKib-0006vP-RT; Fri, 19 Jun 2020 13:22:23 -0400 Original-Received: by mail-qk1-x72c.google.com with SMTP id q198so1829693qka.2; Fri, 19 Jun 2020 10:22:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=+s3BeRCrdSckqBWt55gPzTnfCm8qHDxPoApcgwfND9M=; b=p7BvIqWNQ1eURt99iB/TEWklpXQN6MZucBvYEDjX8CcrAlyllX2sEOSYSOT5cOn8dx JkBn/Oo5+dXRBFX6/hJYDa5ahxGW9sxSyICODpQbIGE6JvQwLyXMJHIiapX4r1XhC9lS 4LSb4935Iawu+B1eizCvvMIsFQk2FZJkDUJ+9uDvF2xXmPQhMn6iHjFuFdCrGz+8Pj15 WIVIRVfbbVLBGNGWwjfsBJvTec616Xu8nYAcvkZk7j2dYzNCew+fIBQ+XUFU0EnejGLo 16ScSXRZiyb9rWvDjIhgP99FFD2zKkUgQJF9tft2meUKeFxp4ZIZfOD7Ij66Tcc/k0TU 4MFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=+s3BeRCrdSckqBWt55gPzTnfCm8qHDxPoApcgwfND9M=; b=VkTshU50rrJ7KNqt+4NyzuQrVncWh6whoBrvWTAA3m70+3GJMvVJxZeoGn1N8GCfZ7 kpiwMw/g0Rm9dkTmCEqrfTh64o42ZKp4ZJHv3MtM6eQXEJ2h9qDccHMc/4s95IaIIi9t 3q5Wmb6fikyJNQOvSx2rfFDXk9wibvgseZsRbu2jHuMZGpP7rqYFx8AZsA2lnfsfdzpe J9dGRrva6xVLI04fc4oPI/wuwobupOAW2bQtYNmiRn6r9Uwk5AeOpNEhKfn1zKYnYHq+ +n/z6XWk+NxH9x9cyGcYPXsoHIbtgRYbIw9ZN5VVJ8z9sXm1yHlyCxyyqfX7YXskiiJB ZDlQ== X-Gm-Message-State: AOAM533/r+xyOXcOliNMuNTm7YAy5T7CBOZcin/2Ctvoz2F96sJO5BMH UsZKojhJeKDp4rUihVgN1CFzqu10DsT2Lw== X-Google-Smtp-Source: ABdhPJy7l1XE/L5fRKS4uRdk0KP6t42S7uIbVUiS+B2f+v+kDNcTBKBf0p7C35neN0yB1wdTVPLutg== X-Received: by 2002:ae9:e895:: with SMTP id a143mr4635002qkg.359.1592587340215; Fri, 19 Jun 2020 10:22:20 -0700 (PDT) Original-Received: from ?IPv6:2601:98a:4200:9210:f9:e10f:5b2e:903c? ([2601:98a:4200:9210:f9:e10f:5b2e:903c]) by smtp.gmail.com with ESMTPSA id h64sm6996393qkf.46.2020.06.19.10.22.19 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 19 Jun 2020 10:22:19 -0700 (PDT) In-Reply-To: <83sgerxmbs.fsf@gnu.org> X-Mailer: Apple Mail (2.3608.80.23.2.2) Received-SPF: pass client-ip=2607:f8b0:4864:20::72c; envelope-from=casouri@gmail.com; helo=mail-qk1-x72c.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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, 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:252380 Archived-At: > On Jun 19, 2020, at 8:38 AM, Eli Zaretskii wrote: >=20 >> From: Yuan Fu >> Date: Fri, 19 Jun 2020 08:04:47 -0400 >> Cc: Lars Ingebrigtsen , >> emacs-devel@gnu.org >>=20 >>> Maybe I don't understand the exact meaning of NOT_AT_EOL/NOT_AT_BOL >>> that Kinsoku assigns to that. Can you provide a formal definition = of >>> that, or point me to some document where that is explained? =20 >>=20 >> Since kinsoku.el is for asian characters which are all LTR[1], the = exact meaning of NOT_AT_EOL/NOT_AT_BOL in bidi context probably = doesn=E2=80=99t really matter, but to make kinsoku retain the same = behavior (thus looks right) in both RTL and LTR lines, I choose to = define BOL as left edge and EOL as right edge. So NOT_AT_EOL means = can=E2=80=99t be the right-most character in a line. >>=20 >> =46rom your message I thought in RTL lines the iterator draws from = right to left (you said each glyph is prepended to the previous one). So = in RTL context when we are at the end of a logical line, we are at the = left edge; on the other hand, in normal LTR context when we are at the = end of a logical line, we are at the right edge. Hence the flip. >=20 > What do you mean by "in the RTL context"? >=20 > Remember: bidi reordering can take place in two different situations: > then the paragraph direction is left-to-right, and when it's > right-to-left. In the former situation, the lines begin on the left, > in the latter they begin on the right. But LTR text, such as CJK > characters, will always be rendered left-to-right, no matter what is > the paragraph direction. >=20 > So which "RTL context" did you mean here? Oooh so there are four cases: LRT text in LTR paragraph, LRT text in RTL = paragraph, RTL text in RTL paragraph, and RTL text in LTR paragraph. And = the order in which the iterator draws glyphs depends on the paragraph = order (although it doesn=E2=80=99t know it). Am I right? >=20 >> As I mentioned above, I don=E2=80=99t think kinsoku cares/is defined = for this situation. And I took the definition to assume strict LTR, = mapping BOL to left and EOL to right. The ultimate effect is that, no = matter what the bidi context is, NOT_AT_EOL character, like =E3=80=8A, = never appears at the right edge. So we don=E2=80=99t get >>=20 >>=20 >> =E6=88=91=E4=BB=8A=E5=A4=A9=E7=9C=8B=E6=9D=A5=E4=BA=86=E6=9C=AC=E4=B9=A6= =EF=BC=8C=E6=84=9F=E8=A7=89=E6=8C=BA=E6=9C=89=E6=84=8F=E6=80=9D=EF=BC=8C=E5= =90=8D=E5=AD=97=E6=98=AF=E3=80=8A >> =E9=92=A2=E9=93=81=E6=98=AF=E6=80=8E=E6=A0=B7=E7=82=BC=E6=88=90=E7=9A=84= =E3=80=8B=E3=80=82 >>=20 >> Instead, we have >>=20 >> =E6=88=91=E4=BB=8A=E5=A4=A9=E7=9C=8B=E6=9D=A5=E4=BA=86=E6=9C=AC=E4=B9=A6= =EF=BC=8C=E6=84=9F=E8=A7=89=E6=8C=BA=E6=9C=89=E6=84=8F=E6=80=9D=EF=BC=8C=E5= =90=8D=E5=AD=97=E6=98=AF >> =E3=80=8A=E9=92=A2=E9=93=81=E6=98=AF=E6=80=8E=E6=A0=B7=E7=82=BC=E6=88=90= =E7=9A=84=E3=80=8B=E3=80=82 >=20 > What do you see in the text below? >=20 > =D7=90=D7=91=D7=92=D7=93 =D7=94=D7=95=D7=96=D7=97=D7=98=D7=99=D7=9B=D7=9A= =D7=9C=D7=9E=D7=A0=D7=9F = =E6=88=91=E4=BB=8A=E5=A4=A9=E7=9C=8B=E6=9D=A5=E4=BA=86=E6=9C=AC=E4=B9=A6=EF= =BC=8C=E6=84=9F=E8=A7=89=E6=8C=BA=E6=9C=89=E6=84=8F=E6=80=9D=EF=BC=8C=E5=90= =8D=E5=AD=97=E6=98=AF > =E3=80=8A=E9=92=A2=E9=93=81=E6=98=AF=E6=80=8E=E6=A0=B7=E7=82=BC=E6=88=90= =E7=9A=84=E3=80=8B=E3=80=82 >=20 > (I assume you are reading your email in Emacs; if not, copy/paste this > text into an Emacs buffer whose bidi-paragraph-direction is nil, and > look at the resulting display.) >=20 > Does the above look correct, from the Kinsoku POV? This is how LTR > CJK text will be displayed in a paragraph with right-to-left base > direction. Do you still think something needs to be flipped here? Kinsoku looks right, yes. However the period (=E2=80=9C=E3=80=82=E2=80=9D)= seems to be interpreted as RTL text, not sure why. >=20 >> Now, is that mapping TRT for other characters? I don=E2=80=99t know. = But I think it make sense for kinsoku (again, asian text, all LRT). = IMHO, maybe for a generic definition we can define BOL as left edge for = LTR character and right edge for RTL character. I think that will look = good for most text. >=20 > We must use BOL and EOL in their logical-order meanings, otherwise the > result will be utter confusion. In the above example, the EOL > character in the first line is =E6=98=AF, and it is not at the left = edge of > the line. It is at the logical-order end of the line, i.e. the > character after it in the buffer position order is the newline. But > if we had RTL characters instead of the CJK text above, the character > at EOL would indeed have been displayed at the left edge of the line. >=20 I see. However, I suggest to define EOL and BOL (in kinsoku) in terms of = visual edges, instead of the logical order. Because we are using this = information (NOT_AT_BOL, etc) for visual layout. When we are at a window = edge and ask if this character can appear at this edge, we are = interested in the visual aspect rather than the logical order, if you = get what I mean.=20 BTW, what does it->bidi_p mean exactly? Does it mean = bidi-display-reordering is t, or current paragraph is =E2=80=98right-to-le= ft, or the char at point is RTL, or something else? (I think I used it = wrong in the patch) Can I know whether I=E2=80=99m at the left edge or = the right edge? Thanks for patiently educating me on this, I=E2=80=99m making slow = progress :-) Yuan=