Bidi paragraph direction in terminal emulators BiDi in terminal emulators
Eli Zaretskii via Unicode
unicode at unicode.org
Thu Feb 7 08:27:08 CST 2019
> Date: Thu, 7 Feb 2019 00:45:55 +0100
> Cc: unicode Unicode Discussion <unicode at unicode.org>
> From: Egmont Koblinger via Unicode <unicode at unicode.org>
> > Not necessarily. One could allow the first strong character in the
> > prompt to determine the paragraph directions
> How does Emacs know what's a prompt? How can it tell it from the
> previous and next command's output?
It uses a regular expression, see term-prompt-regexp.
> Whatever it does to know where the prompt is, can it be made into a
> standard, cross-terminal feature?
Not sure. It's a kind of heuristic, which is why the regexp is
customizable on user level, so that users could adapt it to their
needs, should that be necessary.
> > That's what the Emacs
> > terminal (invoked by M-x term; top level definition in term.el) does.
> I tried it. Executed my default shell, and inside that, a "cat
> TUTORIAL.he". All the paragraphs are rendered as LTR ones,
> left-aligned. Not the way the file is opened in Emacs.
In what version of Emacs is that? In the latest version 26 I have
here, the tutorial displays with most paragraphs in RTL direction.
> If you claim Emacs's built-in terminal emulator supports BiDi, I'm
> kindly asking you to present a documentation of its behavior, in
> similar spirit to my BiDi proposal.
The Emacs terminal emulator displays text as any other text in any
other Emacs buffer, so it supports the same bidi reordering as
elsewhere. You could make it emulate other terminals by setting the
variable bidi-paragraph-direction to either left-to-right or
right-to-left, then all the paragraphs will have the base direction
you specify. But the default value of this variable in term buffers
is nil, which invokes dynamic determination of base paragraph
More information about the Unicode