all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: nisse@lysator.liu.se (Niels Möller)
Cc: 43207@debbugs.gnu.org
Subject: bug#43207: 26.3; Strange bidi behavior
Date: Fri, 04 Sep 2020 23:03:13 +0300	[thread overview]
Message-ID: <835z8tqpha.fsf@gnu.org> (raw)
In-Reply-To: <cpf363xs59y.fsf@fukushima.lysator.liu.se> (nisse@lysator.liu.se)

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	other threads:[~2020-09-04 20:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-04 19:36 bug#43207: 26.3; Strange bidi behavior Niels Möller
2020-09-04 20:03 ` Eli Zaretskii [this message]
2020-09-05  0:09   ` Stefan Kangas
2020-09-05  6:46   ` Niels Möller
2020-09-05  7:35     ` Eli Zaretskii

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

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

  git send-email \
    --in-reply-to=835z8tqpha.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=43207@debbugs.gnu.org \
    --cc=nisse@lysator.liu.se \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.