nano-devel
[Top][All Lists]
Advanced

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

Re: support for RTL text directly in the terminal?


From: Mahyar Abbaspour
Subject: Re: support for RTL text directly in the terminal?
Date: Wed, 12 Feb 2020 05:01:58 +0330

Hi Benno,

On Tue, Feb 11, 2020 at 7:24 PM Benno Schulenberg <address@hidden> wrote:

Five years ago you posted about adding support for right-to-left languages
to nano [1].  Today I happened to stumble over a relevant item in the TODO
list.  After some googling, I found that there exists a terminal (mlterm)
that supports RTL text. [2]  It seems to work, although it is weird to see
the cursor move rightward when typing the left arrow...
My question is: is this usable?  I mean: can one comfortably edit an RTL
text using nano on mlterm?  Or is it awkward, confusing, troublesome?

Thanks for reviving this topic. To be honest, I don't use mlterm. I have tried it a few
times during the past few years but in every try, I was unable to get any decent RTL
output from it. Maybe I didn't go deep enough to get it to work properly, but you
normally expect a terminal emulator to just work out of the box. In a nutshell,
I found mlterm to be cryptic and hard-to-use.

Back to five years ago, I spent some time on a fork of nano with RTL support and
as far as I remember, I had a semi-working implementation. As I was working on
the project, I gradually came to conclusion that if I could solve the problem in the
lower layer, I mean in the terminal emulator layer, I could have a much simpler
implementation in nano.

As an example, in some languages such as Persian and Arabic, characters take
different shapes depending on the position of the character in a word. A render
engine should detect the character position and output the appropriate shape.
This is called the shaping phase.

The shaping phase, for example, could be pushed to terminal emulator so that
programs such as cat, would be able to output Persian text without any modification.
Otherwise, you would need to add support for such languages to every utility program!

But the problem is much more complicated than it seems. Terminal emulators are
broken by design. The original designers of the terminals had only LTR languages in
their mind. To make the matters worse, not only languages such as Urdu are RTL, but
also they are actually bidirectional! The alphabetic characters are written from right to
left while the numbers written from left to right. This is also true for Arabic and Persian.

Long story short, I think there are two options. The first one is to push some of the
work to the terminal emulators such as  the shaping phase. This way, many programs
would benefit from it, but it requires to heavily patch the existing terminal emulators
e.g. xterminal, or creating new terminal emulators such as mlterm in a way that
just work!

The second one is to handle everything in the application e.g. nano, vim, etc. This is
much easier to implement but you will still have a broken terminal emulator in which
you are not able to pass a Persian file name to nano on the command line, since
you can't type the name in your terminal!


--
Best regards,
Mahyar

reply via email to

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