Bidi paragraph direction in terminal emulators BiDi in terminal emulators

Richard Wordingham via Unicode unicode at unicode.org
Thu Feb 7 02:17:23 CST 2019


On Thu, 7 Feb 2019 00:45:55 +0100
Egmont Koblinger via Unicode <unicode at unicode.org> wrote:

> Hi Richard,
> 
> > 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?

I don't believe the Emacs terminal does either.  What's special about
the prompt is that it starts a line, so most paragraphs start with a
prompt.  Not all prompts contain a strong character.  To let a file's
contents control directionality, instead of issuing the command 'cat
file1' one would have to issue a shell command '(echo; cat file1)' or
similar to terminate the paragraph containing the prompt.  The 'echo'
inserts an empty line.

> > 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.

See above.  I don't know how what your shell is.

> 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.

I've a feeling it has emergent behaviour, and may require a lot of
experimentation to elucidate.

> Does this logic also apply to single newline characters? If not, why
> not, what's the conceptual difference? If it does, why do text files
> end in a newline?

I don't like the convention that removing the newline from the end of a
non-empty line changes it into a binary file.  The short answer is that
some editors allow a text file not to have a final newline; such files
are not handled well in the Unix environment.

Some things are just untidy messes.  Compare C, where a semicolon
*terminates* statements, but some are terminated by '}', and a
semicolon *separates* the expression within the control part of a for
statement, and a comma *separates* the constant definitions in an enum
declaration - for a long time, a trailing comma inside the braces was
illegal.

Richard. 


More information about the Unicode mailing list