Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
BiDirectional Text

This gist will show the support of BiDirectional text in the terminal emulators and console programs. You can read more about the standardization efforts at the dedicated page of FreeDesktop Terminal BiDi working group.

How to test

Logical Order ◀ ◀ ◀ RTL LTR ▶ ▶ ▶
WHAT IS UNICODE؟ in arabic in arabic ؟EDOCINU SI TAHW ؟EDOCINU SI TAHW in arabic
ما هو الترميز الموحد يونيكود؟ in Arabic ما هو الترميز الموحد يونيكود؟ in Arabic

Supporting BiDirectional text

According to a new standard

Please note, that specification is preliminary yet, and VTE implementation is still work in progress:

Incompatible and incomplete implementations

Supporting BiDirectional text programs, but incompatible

Not supporting BiDirectional text

Terminal multiplexers

Not supporting BiDirectional text programs

@XVilka

This comment has been minimized.

Copy link
Owner Author

XVilka commented Apr 13, 2015

@ali-hardan

This comment has been minimized.

Copy link

ali-hardan commented Oct 23, 2018

Now, qterminal supports bidi.

@XVilka

This comment has been minimized.

Copy link
Owner Author

XVilka commented Oct 26, 2018

Thanks, @ali-hardan, added it.

@mintty

This comment has been minimized.

Copy link

mintty commented Oct 26, 2018

mintty also supports bidi

@XVilka

This comment has been minimized.

Copy link
Owner Author

XVilka commented Oct 28, 2018

Thanks, @mintty, added it.

@faridcher

This comment has been minimized.

Copy link

faridcher commented Nov 6, 2018

Gnome terminal and xterm are supported as mentioned at https://github.com/behdad/bicon

@XVilka

This comment has been minimized.

Copy link
Owner Author

XVilka commented Nov 8, 2018

@faridcher here I am speaking about native BiDi support, without the hacks like bicon.

@egmontkob

This comment has been minimized.

Copy link

egmontkob commented Jan 29, 2019

I do not understand the "How to test" section, really not sure how to interpret it, not sure what to do with that text in my terminals to test them.

Could you please provide something along the lines of "do this" (emphasis on the word "do") and "if it looks like this then it's good, if it looks like that then it's bad"?

@egmontkob

This comment has been minimized.

Copy link

egmontkob commented Jan 29, 2019

I've spent the last few months studying and evaluating the only document about BiDi in terminals that I could locate, as well as existing implementations. Unfortunately I have severe problems with all of them.

The most important problem with all the self-claimed BiDi-aware terminals is that they always apply the Unicode BiDi algorithm on the contents, giving no way for applications to switch it off. This way they literally, mathematically provably become a platform on top of which it's impossible to implement proper BiDi-aware text viewing/editing experience. (In most terminals you can disable BiDi in the settings, but it's an unacceptable user experience if people have to do so every time they start up or quit a text editor.)

They also work on lines of text rather than paragraphs, lack support for overall RTL direction, and suffer from various one-off problems as well.

Thus I'd make the bold claim that the terminals mentioned above as supporting BiDi actually don't. Supporting BiDi doesn't mean unconditionally doing it, since it does about as much harm as good. Supporting BiDi means (among plenty of other things) knowing when to do it and when not to.

I came up with a draft specification on how BiDi should be done in terminal emulators, it's at https://terminal-wg.pages.freedesktop.org/bidi/ . Feedback about this spec is welcome over there. I'm making a somewhat bold, but well supported claim that only terminals that implement BiDi according to this spec should be called BiDi-aware.

Recently Mintty did a couple of improvements, partially along the lines of the new specs. I haven't yet had a chance to evaluate what it supports now and what it still doesn't.

@DirectorX

This comment has been minimized.

Copy link

DirectorX commented Jan 29, 2019

Rxvt-unicode with fribidi (Perl) plugin supporting bidirectional text

@XVilka

This comment has been minimized.

Copy link
Owner Author

XVilka commented Jul 2, 2019

Just an update - was recently implemented in libvte by @egmontkob: https://terminal-wg.pages.freedesktop.org/bidi/implementations.html#vte

@faridcher

This comment has been minimized.

Copy link

faridcher commented Jul 3, 2019

https://github.com/aligrudi/neatvi a fork of VI works great and may be included in the list of programs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.