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!