Bidirectional text

From ArchWiki

From Wikipedia:Bidirectional text, is text that contains two text directionalities, right-to-left (RTL) and left-to-right (LTR).


Text direction
in text editing, setting text direction changes how the program interacts with typed text including changes in text navigation, text selection, and text insertion.
Text alignment
text alignment only changes how text is displayed and styled.
Fake Bidi
a fake locale displaying completely reversed English sentences to mimic a RTL context. This helps developers who do not speak a RTL language to deal with RTL issues. For example:
This English sentence contains SDROW CIBARA EMOS and ends with English words.
Poor man's bidi mode
automatic visual text order right-to-left input in normal terminal.
Logical navigation
words are traversed as they are read.
Visual navigation
words are traversed as they are displayed. This GIF demonstrates the difference between the two.

Logical navigation is the correct way of navigation that programs should implement to fully support Bidi. Despite that, it would be preferable to have a switch between the two.

Unicode support
there are three main Unicode control characters: Wikipedia:RLM, Wikipedia:LRM, Wikipedia:ALM.
Bidirectional Algorithm
is the set of rules applied to display text in the correct order.

fribidi-gitAUR is an open source implementations of Bidi Algorithm. python-bidiAUR is a python library for related functions.


In order for a program to fully support Bidi text, it must have:

Letter rendering (RTL)
able to correctly apply letter shaping and ligatures. See Complete Text Layout. This is often referred to shortly as RTL support.
Switch text alignment (Bidi)
E.g: Firefox Ctrl+Shift+X shortcut.
Logical navigation
in a RTL text, with RTL text alignment, arrow keys should not cause reversed navigation.
Tag App Date RTL Bidi Nav Notes
browser chromium 2022-08-28 Yes No Yes Chromium is the engine of ElectronJS. Fixing this should resolve Electron Apps too.
browser firefox 2022-09-01 Yes No No
browser qtwebbrowser 2022-11-01 Yes No
browser webkit 2022-11-01 Yes No
editor AbiWord 2007-12-06 Yes
editor emacs 2019-06-31 Yes No With extension
editor kate 2016-06-20 Yes No
editor LibreOffice Yes Yes Yes fully supported. Enabled using Complex Text Layout from settings.
editor neovim 2014-04-17 No No see :set arabic
editor texworks 2009-03-01 Yes No
editor vim 2015-08-19 No No see :set arabic
other groff 2005-12-02 No No
other Wikipedia:HTML Yes Yes Yes
other latex Yes Yes Using LuaTeX or XeLaTeX with polyglossia
other wine 2002-04-21 Yes No
terminal alacritty 2017-07-15 No
terminal dvtm 2019-10-12 No
terminal gedit Yes No For Gedit <= 2.1, workaround by extension.
terminal irssi 2019-10-12 No
terminal kitty 2019-11-01 No
terminal konsole Yes No
terminal libvte Yes No including libvte-based like Gnome, sakura, xfce4...
terminal mltermAUR Yes No
terminal neatvi-gitAUR 2019-07-04 No
terminal pymux 2019-10-12 No
terminal qterminal Yes No
terminal radare2 2015-02-03 No
terminal tmux 2019-10-12 No won't fix
terminal wezterm 2021-05-11 No
terminal xstAUR 2018-10-26 No


Verify UTF-8 Encoding is properly configured first. Make sure you install the fonts corresponding to your language: Arabic, Persian, Hebrew. For some terminal, (bicon-gitAUR) is required to properly display Arabic and Hebrew text.

Temporary workarounds

See also

Internal links

External links