emacs-devel
[Top][All Lists]
Advanced

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

Re: [emacs-bidi] Mixed L2R and R2L paragraphs and horizontal scroll


From: Eli Zaretskii
Subject: Re: [emacs-bidi] Mixed L2R and R2L paragraphs and horizontal scroll
Date: Wed, 03 Feb 2010 20:59:13 +0200

> Date: Wed, 3 Feb 2010 15:10:52 +0200
> From: "Ehud Karni" <address@hidden>
> Cc: address@hidden, address@hidden
> 
> On Tue, 02 Feb 2010 22:04:51 Eli Zaretskii wrote:
> >
> > So let me tell directly and unequivocally what I propose.  There are
> > two main principles:
> >
> >   . Line truncation and continuation is done in the visual order
> >
> >   . Horizontal scrolling is done in the logical order
> 
> What you describe here is the Emacs screen as rectangle frame moving
> over the visual ordered text.

For truncation and continuation, yes.  For horizontal scrolling, no:
it works in the logical order.  That is, scroll-left moves text in
each line towards its respective margin: left margin for L2R lines,
right margin for R2L.  More about this near the end of this message.

> No word processor that uses that approach (check open-office with a
> long enough text, or with the other OS word processor).

I didn't try OpenOffice, but that "other OS word processor" does it
exactly like I described, at least with truncation (it does not have
the equivalent of continuation lines, AFAICS).

Maybe you are talking about how lines are re-flowed by these word
processors.  If so, the Emacs equivalent is fill-paragraph, or the
various packages (like longlines) that do it automatically for you.
When a line is filled, a newline is inserted, and then the order of
the text spread between several lines is what you expect:

> > What this means is that an L2R line that ends with a stretch of R2L
> > text will be continued as follows:
> >
> >        +-------------------------------+
> >        |name2 1234 catag2 NOITPIRCSED-\|
> >        |GNOL-YREV                      |
> >        +-------------------------------+
> 
> See the problem - the user must start reading from the second line.

Right.  If you want to read it correctly, use fill-paragraph.  Then
this will display as

        +-------------------------------+
        |name2 1234 catag2 -GNOL-YREV   |
        |NOITPIRCSED                    |
        +-------------------------------+

(That's because bidi reordering stops at the newline and restarts anew
after it.)

> > Similarly, an R2L line will be continued like this:
> >
> >        +-------------------------------+
> >        |/RCSED-GNOL-YREV-YREV-YREV-YREV|
> >        |                         NOITPI|
> >        +-------------------------------+
> >
> > and truncated like this:
> >
> >        +-------------------------------+
> >        |$RCSED-GNOL-YREV-YREV-YREV-YREV|
> >        +-------------------------------+
> 
> This is the correct way.

The truncation and continuation will always be ``correct'' in L2R
lines with only left to right text, and in R2L lines with only
right-to-left text.  The ``problem'' happens only in mixed lines, and
then when the line is truncated or continued in the middle of a run of
text whose direction is the opposite of the line direction (actually,
of the base paragraph direction).

> The logical text is "some latin text followed by HEBREW VERY1 VERY2
> LONG TEXT FOR DEMONSTRATING OF THE DIFFERENT SCROLLING OPTIONS AND
> THE UNNATURAL RESULT OF ELIS APPROACH WITH small latin tail"
> 
> With your approach it will appear as (first, wider screen):
> 
>        +----------------------------------------+
>        |some latin text followed by HTIW HCAORP$|
>        |PA SILE FO TLUSER LARUTANNU EHT DNA SNO$|
>        |ITPO GNILLORCS TNEREFFID EHT FO GNITART$|
>        |SNOMED ROF TXET GNOL 2YREV 1YREV WERBEH$|
>        | small latin tail                       |
>        +----------------------------------------+
> 
> The Hebrew starts at 4th visual lines and goes upward.

No, this is some kind of misunderstanding, because there can be no
such display, not with the truncation glyphs.  Is the logical text
just a single line?  If so, the display will be like this:

       +----------------------------------------+
       |some latin text followed by HTIW HCAORP\|
       |PA SILE FO TLUSER LARUTANNU EHT DNA SNO\|
       |ITPO GNILLORCS TNEREFFID EHT FO GNITART\|
       |SNOMED ROF TXET GNOL 2YREV 1YREV WERBEH\|
       | small latin tail                       |
       +----------------------------------------+

And yes, the R2L text reads bottom to top.  But rewriting the central
piece of the display engine to make this use-case look better is
beyond my resources.  There's a lot of more important (IMO) issues to
take care of.  If this will really annoy users (and we won't know
until bidi Emacs hits the FTP sites, because these features are unique
to Emacs), someone else will have to come and do the surgery it takes,
sorry.

> with smaller screen (assume only 7 lines long):
> 
>        +--------------------+
>        |some latin text fol$|
>        |lowed by HTIW HCAOR$|
>        |PPA SILE FO TLUSER $|
>        |LARUTANNU EHT DNA S$|
>        |NOITPO GNILLORCS TN$|
>        |EREFFID EHT FO GNIT$|
>        |ARTSNOMED ROF TXET $|
>        +--------------------+

Again, I think you meant \ for continuation lines, not $ for
truncation.

> Oops, the beginning of the Hebrew text disappeared.

And this is significantly worse than if the _end_ of the text
disappears, because...?

>        +--------------------+
>        |$ 2YREV 1YREV WERBEH|
>        |$NOMED ROF TXET GNOL|
>        |$FID EHT FO GNITARTS|
>        |$PO GNILLORCS TNEREF|
>        |$TANNU EHT DNA SNOIT|
>        |$SILE FO TLUSER LARU|
>        |$???? HTIW HCAORPPA |
>        +--------------------+
> The last line ???? are "tail" by Eli's way and "smal" by my way.

Yes, but that continuation glyph should tell me and you that there's
more text out of view.

> I claim the scrolling should follow the "same" rules.
> e.g. 1: wide screen scrolled 20 (half width):
>        +----------------------------------------+
>        |$owd by OF TXET GNOL 2YREV 1YREV WERBEH$|
>        +----------------------------------------+

That's not the same rules applied to scrolling, that's exactly the
same situation of truncating a mixed L2R/R2L text as you described
above.

The issue with scrolling was when you have _two_ different paragraphs,
one with left-to-right base direction, the other with right-to-left.
Like this:

       +----------------------------------------+
       |some latin text                         |
       |                                        |
       |                        TXET WERBEH EMOS|
       +----------------------------------------+

(The empty line in between causes the last line to start a new
paragraph.)

The issue I raised was what should happen if I now type "C-u 2 C-x <".
My conclusion from this discussion (and thanks to all who contributed)
is that the resulting display should be this:

       +----------------------------------------+
       |$e latin text                           |
       |                                        |
       |                          TXET WERBEH E$|
       +----------------------------------------+

That is, each line scrolls towards its logical-order beginning.
"Logically-left", so to say.

(Hmm, does it mean "COPYLEFT" will be displayed as "THGIRYPOC"?
That's _really_ bad, isn't it?)




reply via email to

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