Page MenuHomePhabricator

Terminology incorrectly displays RTL scripts
Open, HighPublic

Description

Right to left scripts are displayed left to right.
Arabic and Hebrew are the most common example.

bel3atar created this task.Apr 11 2017, 6:21 AM

Do you have examples?

bel3atar added a comment.EditedApr 12 2017, 1:13 AM

here's an arabic example


here's the text I used:
لكن لا بد أن أوضح لك أن كل هذه الأفكار المغلوطة حول استنكار النشوة وتمجيد الألم نشأت بالفعل، وسأعرض لك التفاصيل لتكتشف حقيقة وأساس تلك السعادة البشرية، فلا أحد يرفض أو يكره أو يتجنب الشعور بالسعادة، ولكن بفضل هؤلاء الأشخاص الذين لا يدركون بأن السعادة لا بد أن نستشعرها بصورة أكثر عقلانية ومنطقية فيعرضهم هذا لمواجهة الظروف الأليمة، وأكرر بأنه لا يوجد من يرغب في الحب ونيل المنال ويتلذذ بالآلام، الألم هو الألم ولكن نتيجة لظروف ما قد تكمن السعاده فيما نتحمله من كد وأسي.

With hebrew:


Text used: תנך את סרבול בחירות חבריכם, דת המחשב בהשחתה זכויות מדע.

As you can see the letters are flipped

I'm guessing Terminology needs a proper bidi implementation ( spec )
FriBidi is one of them https://fribidi.org/

How does it work in other terminals?

bel3atar added a comment.EditedApr 12 2017, 6:21 AM

I have no idea as of how they implement it, but here are examples of terminal emulators doing it right:

Konsole: text is most importantly RTL, so readable; but not right aligned, which is not a big problem. It's like having an English paragraph aligned to the right.
mlterm: text is RTL and right aligned.

Do you type it yourself or do you copy-paste it?
Could you make me a very simple shell script that would print some RTL text? What happens if RTL text is mixed on the same line with LTR text?

It doesn't matter if I type it or paste it, the result is always the same.
curl http://ix.io/qpv
What should happen is decided by the Unicode bidirectional algorithm http://www.unicode.org/reports/tr9/

egmont added a subscriber: egmont.Nov 18 2018, 9:18 AM

There's much much more to BiDi in terminals than just applying the Unicode BiDi algorithm. For example, if you unconditionally apply the BiDi algorithm on contents, it becomes literally impossible to have proper BiDi-aware text editing experience on that platform.

See https://terminal-wg.pages.freedesktop.org/bidi/ for my draft proposal for how BiDi in terminals should work. Feel free to open an issue there if you have any feedback on the proposal. In the mean time, it would be great if Terminology implemented BiDi according to that specification.

I've been improving escape code parsing lately and it's not yet over.

@egmont Thank you for your bug reports by the way.

I'll probably look into it later it.

Ps: I'm @borisfaure on fdo's gitlab if needed.