GNU bug report logs - #43207
26.3; Strange bidi behavior

Previous Next

Package: emacs;

Reported by: nisse <at> lysator.liu.se (Niels Möller)

Date: Fri, 4 Sep 2020 19:37:01 UTC

Severity: normal

Tags: notabug

Found in version 26.3

Done: Stefan Kangas <stefankangas <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Eli Zaretskii <eliz <at> gnu.org>
To: nisse <at> lysator.liu.se (Niels Möller)
Cc: 43207 <at> debbugs.gnu.org
Subject: bug#43207: 26.3; Strange bidi behavior
Date: Fri, 04 Sep 2020 23:03:13 +0300
tags 43207 notabug
thanks

> From: nisse <at> 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.




This bug report was last modified 4 years and 258 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.