unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Yuan Fu <casouri@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: Lars Ingebrigtsen <larsi@gnus.org>, emacs-devel@gnu.org
Subject: Re: Line wrap reconsidered
Date: Fri, 19 Jun 2020 08:04:47 -0400	[thread overview]
Message-ID: <AC4DA72B-F912-42BB-A080-4972A585C515@gmail.com> (raw)
In-Reply-To: <838sgjzij2.fsf@gnu.org>



> On Jun 19, 2020, at 2:17 AM, Eli Zaretskii <eliz@gnu.org> wrote:
> 
>> From: Yuan Fu <casouri@gmail.com>
>> Date: Thu, 18 Jun 2020 17:46:53 -0400
>> Cc: Lars Ingebrigtsen <larsi@gnus.org>,
>> emacs-devel <emacs-devel@gnu.org>
>> 
>> I have to do another change for kinsoku.el to work right in bidi. Kinsoku.el defined NOT_AT_BOL and NOT_AT_EOL categories. These categories are flipped in bidi paragraphs: what was EOL becomes BOL and vice versa. So I flipped them in my predicate function depending on it->bidi_p.
> 
> I don't think I understand what you mean here.  BOL and EOL are
> logical-order terminology, and bidi reordering doesn't change their
> meaning.
> 
> 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?  

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’t 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’t be the right-most character in a line.

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

> The
> important aspect of this is that in bidi-reordered text the character
> that appears at the left edge of a line is not necessarily the first
> character of the line after the preceding newline.  So the issue is
> what does Kinsoku say about such situations?  IOW, definitions that
> assume strict LTR text will not help us here.

As I mentioned above, I don’t 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 《, never appears at the right edge. So we don’t get


我今天看来了本书,感觉挺有意思,名字是《
钢铁是怎样炼成的》。

Instead, we have

我今天看来了本书,感觉挺有意思,名字是
《钢铁是怎样炼成的》。


Now, is that mapping TRT for other characters? I don’t 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.

Yuan

[1] There is also a top-down layout, but I don’t think we need to worry about that.





  reply	other threads:[~2020-06-19 12:04 UTC|newest]

Thread overview: 88+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-25 18:13 Line wrap reconsidered Yuan Fu
2020-05-25 19:23 ` Eli Zaretskii
2020-05-25 19:31   ` Yuan Fu
2020-05-26  1:55   ` Ihor Radchenko
2020-05-26 12:55     ` Joost Kremers
2020-05-26 13:35       ` Yuan Fu
2020-05-26 14:47     ` Eli Zaretskii
2020-05-26 15:01       ` Ihor Radchenko
2020-05-26 15:29         ` Eli Zaretskii
2020-05-26 15:46           ` Ihor Radchenko
2020-05-26 16:29             ` Eli Zaretskii
2020-05-26 15:59       ` Stefan Monnier
2020-05-26 16:31         ` Eli Zaretskii
2020-05-26 16:43           ` Yuan Fu
2020-05-26 16:43             ` Ihor Radchenko
2020-05-26 18:57             ` Eli Zaretskii
2020-05-26 19:10               ` Yuan Fu
2020-05-26 19:59                 ` Eli Zaretskii
2020-05-26 19:12               ` Ihor Radchenko
2020-05-26 20:04                 ` Eli Zaretskii
2020-05-26 21:01                   ` Stefan Monnier
2020-05-25 19:31 ` Stefan Monnier
2020-05-25 19:51   ` Yuan Fu
2020-05-25 20:43 ` Lars Ingebrigtsen
2020-05-25 23:26   ` Yuan Fu
2020-05-25 23:32     ` Yuan Fu
2020-05-26  2:15       ` Yuan Fu
2020-05-26  3:30         ` Yuan Fu
2020-05-26  4:46           ` Yuan Fu
2020-05-26 15:14             ` Eli Zaretskii
2020-05-26 15:00           ` Eli Zaretskii
2020-05-26 14:54       ` Eli Zaretskii
2020-05-26 17:34         ` Yuan Fu
2020-05-26 19:50           ` Eli Zaretskii
2020-05-26 20:31             ` Yuan Fu
2020-05-26 22:29               ` Yuan Fu
2020-05-27 17:29                 ` Eli Zaretskii
2020-05-28 17:31                   ` Yuan Fu
2020-05-28 18:05                     ` Eli Zaretskii
2020-05-28 19:34                       ` Yuan Fu
2020-05-28 20:42                         ` Yuan Fu
2020-05-29  7:17                           ` Eli Zaretskii
2020-05-29  6:56                         ` Eli Zaretskii
2020-05-29 21:20                           ` Yuan Fu
2020-05-30  6:14                             ` Eli Zaretskii
2020-05-31 17:39                               ` Yuan Fu
2020-05-31 17:55                                 ` Eli Zaretskii
2020-05-31 18:23                                   ` Yuan Fu
2020-05-31 18:47                                     ` Eli Zaretskii
2020-06-18 21:46                                       ` Yuan Fu
2020-06-19  6:17                                         ` Eli Zaretskii
2020-06-19 12:04                                           ` Yuan Fu [this message]
2020-06-19 12:38                                             ` Eli Zaretskii
2020-06-19 17:22                                               ` Yuan Fu
2020-06-19 17:47                                                 ` Eli Zaretskii
2020-06-19 18:03                                                   ` Yuan Fu
2020-06-19 18:34                                                     ` Eli Zaretskii
2020-07-12 17:25                                                       ` Yuan Fu
2020-07-12 18:27                                                         ` Eli Zaretskii
2020-07-12 19:28                                                           ` Yuan Fu
2020-07-13 19:46                                                             ` Yuan Fu
2020-07-18  8:15                                                               ` Eli Zaretskii
2020-07-18 17:14                                                                 ` Yuan Fu
2020-07-18 19:49                                                                   ` Yuan Fu
2020-07-18 20:25                                                                   ` Stefan Monnier
2020-07-19 14:52                                                                   ` Eli Zaretskii
2020-07-19 16:16                                                                     ` Yuan Fu
2020-07-19 16:17                                                                       ` Yuan Fu
2020-08-13 19:35                                                                         ` Yuan Fu
2020-08-14  5:55                                                                           ` Eli Zaretskii
2020-08-14 15:08                                                                             ` Yuan Fu
2020-08-15  9:10                                                                               ` Eli Zaretskii
2020-08-15 13:10                                                                                 ` Fu Yuan
2020-08-15 14:56                                                                                   ` Eli Zaretskii
2020-08-15 17:34                                                                                     ` Yuan Fu
2020-08-15 17:46                                                                                       ` Eli Zaretskii
2020-08-15 18:00                                                                                         ` Yuan Fu
2020-08-15 18:47                                                                                           ` Eli Zaretskii
2020-08-16  3:22                                                                                             ` Yuan Fu
2020-08-16 14:15                                                                                               ` Eli Zaretskii
2020-08-16 17:31                                                                                                 ` Yuan Fu
2020-08-22  7:42                                                                                                   ` Eli Zaretskii
2020-08-22 20:58                                                                                                     ` Yuan Fu
2020-08-23  7:12                                                                                                       ` Eli Zaretskii
2020-08-24 14:00                                                                                                         ` Yuan Fu
2020-05-27 15:20               ` Eli Zaretskii
2020-05-26  8:02 ` martin rudalics
2020-05-26 12:38   ` Yuan Fu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AC4DA72B-F912-42BB-A080-4972A585C515@gmail.com \
    --to=casouri@gmail.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=larsi@gnus.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).