Skip to content

Instantly share code, notes, and snippets.

@XVilka
Last active February 1, 2024 14:53
Show Gist options
  • Star 43 You must be signed in to star a gist
  • Fork 5 You must be signed in to fork a gist
  • Save XVilka/a0e49e1c65370ba11c17 to your computer and use it in GitHub Desktop.
Save XVilka/a0e49e1c65370ba11c17 to your computer and use it in GitHub Desktop.
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

@avidseeker
Copy link

Compiled programs support for Bidi in this ArchWiki article.

@ctrlcctrlv
Copy link

ctrlcctrlv commented Jun 30, 2023

There's finally some movement on this; Unicode Technical Committee №175 approved a Working Group to be called the Terminal Complex Script Support Working Group (TCSS WG) after Microsoft asked for it in L2/23-107.¹

Microsoft wants to do it in a libvte-incompatible way so I plan to attend every meeting of the WG I can just to discuss…why, it seems they may not have even known about prior art. My document is L2/23-153.²

Footnotes

  • ¹ L2/23-107
    Li, Renzhi et al. Proper Complex Script Support in Text Terminals. 2023-04-24.
  • ² L2/23-153
    Brennan, Fredrick R. Opposition to and Comment on L2/23-107. 2023-06-30.

@ninjalj
Copy link

ninjalj commented Jul 2, 2023

@ctrlcctrlv : Re: "Opposition to and Comment on L2/23-107", the BiDi in Terminal Emulators draft proposal is by Egmont Koblinger.

@ctrlcctrlv
Copy link

Yes, sorry, my mistake; @XVilka told me this already via email; but the Unicode office is closed on weekends :-) I'll submit a revised (“R”) version to L2 via docsubmit@ next week.

@hemedani
Copy link

hemedani commented Jul 2, 2023

what about wezterm ?

@ctrlcctrlv
Copy link

What about it?

This output is wrong:

image
For «Wikipedia», ויקיפדיה is the correct writing order, not הידפיקיו.

It fails the two major tests of the debu.tanuki.agency test:

image

It accepts the fribidi'd Hebrew as-is meaning it's on par with kitty (i.e. broken) and mangles the Devanagari worse than Konsole or GNOME Terminal but slightly better than Kitty yet far behind mlterm.

@wez
Copy link

wez commented Jul 9, 2023

@ctrlcctrlv could you share with me how to run the tests you ran with wezterm?

@ctrlcctrlv
Copy link

@wez Sure!

Do:

ssh fred@debu.tanuki.agency

No password. That's not how I ssh to デブ.狸.agency and is there as a joke against would-be crackers and skiddies, but it's useful for this too! (As that message is just my MOTD.)

@anonimo0-0
Copy link

So is there a terminal that supports bidi yet? Gnome terminal isn't that good. I've tried to run Neovim inside it, and got the wrong behavior. mlterm seems to be the one with the best behavior out of all the ones that I've tried, but its documentation is lacking and it doesn't look very nice out of the box.

@ctrlcctrlv
Copy link

that is the state of the art. mlterm does the best job.

@cben
Copy link

cben commented Aug 21, 2023 via email

@ctrlcctrlv
Copy link

perhaps bidi better on win32 but i see dotted circles

fails both deva and hebr

image

@mmstick
Copy link

mmstick commented Dec 20, 2023

cosmic-term supports bidirectional text and ligatures via cosmic-text: https://fosstodon.org/@soller/111602927867586005

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment