bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#43207: 26.3; Strange bidi behavior


From: Eli Zaretskii
Subject: bug#43207: 26.3; Strange bidi behavior
Date: Fri, 04 Sep 2020 23:03:13 +0300

tags 43207 notabug
thanks

> From: nisse@lysator.liu.se (Niels Möller)
> Date: Fri, 04 Sep 2020 21:36:41 +0200
> 
> I get a pretty confusing behavior when I load the file at
> 
>   https://www.lysator.liu.se/~nisse/misc/emacs-bidi-bug-2.txt
> 
> This is what it looks like
> 
>   https://www.lysator.liu.se/~nisse/misc/emacs-bidi-bug-2.png

It is not a bug, but the expected behavior.  The display of
bidirectional text is affected by the "base paragraph direction", and
in Emacs paragraphs are separated by empty lines.  Since there's no
empty line between the Arabic text and the following lines of Latin
text, that Latin text "inherits" the base paragraph direction of
right-to-left, set by the line that has only the Arabic text.

You can either insert an empty line between that Arabic line, or you
can force the entire buffer to be displayed with left-to-right base
directionality by doing

  M-x set-variable RET bidi-paragraph-direction RET left-to-right RET

This is all described in the Emacs manual, btw; see the node
"Bidirectional Editing" there.

> More specifically, C-f moves point in the expected "logical order" of
> the text, which is mostly to the right on the screen. However pressing
> the right-arrow key (bound to right-char) moves cursor to the left on
> most parts of this text (the opposite direction of C-f (forward-char)),
> despite the text being rendered in left-to-right order.

This is also the expected behavior.  It might be surprising for
someone who isn't used to reading bidirectional text, especially when
the base direction of a paragraph is the opposite of the natural text
direction.  But this is how most bidi-supporting applications out
there behave.

If you prefer the arrow keys to move the cursor visually, you can do

  M-x set-variable RET visual-order-cursor-movement RET t RET

(This is also in the manual.)

> I would have expected the later part of the file to be displayed
> left-justified in left-to-right order, with the exception of the single
> word "كاثولي" rendered right-to-left.

That'd cause annoying change of justification to the left or right
when Arabic or Latin words are pushed to the next line due to text
insertion.





reply via email to

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