zevlg / telega.el

GNU Emacs telegram client (unofficial)
https://zevlg.github.io/telega.el/
GNU General Public License v3.0
1.09k stars 85 forks source link

RTL text looks reversed in chats but okay in Telega Root #421

Closed KaKooDa closed 1 year ago

KaKooDa commented 1 year ago

Telega Setup

OS: [uname -a] Linux MyComputerName 5.15.0-67-generic #74+11.0trisquel18 SMP Sun Mar 5 03:14:11 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux Emacs: 27.1 && 29.1 (built with HarfBuzz support) Telega: 0.8.151 (telega-server 0.8.2, TDlib 1.8.15)

Installed from MELPA Telega-server and TDlib built from source

Current Behavior

In "telega root" (I mean the page which shows all chats), The text looks just fine. For example: این یک متن درست است But when I open a chat, the direction reverses. For example above text would look like: تسا تسرد نتم کی نیا in a chat.

Steps to Reproduce

I have just installed Telega on a fresh installed Emacs. The bug should be reproducible with all Persian and maybe other RTL languages as well.

Possible Solution

I think if you should see what makes Persian look right in "telega root" buffer but not in chats buffer. Maybe @dov which knows programming better than me and has already fixed a RTL issue can help.

Thanks.

zevlg commented 1 year ago

Set telega-chat-bidi-display-reordering to desired value, by default bidi is disabled in chatbufs

KaKooDa commented 1 year ago

Thanks! (setq telega-chat-bidi-display-reordering t) in my init.el file solved the issue but introduced new issues. Right now the graphical Emacs works perfectly with Telega but the terminal emacs ($emacs -nw) doesn't. Chats are looking reversed with setting telega-chat-bidi-display-reordering to t (and correct when setting to nil). Also the text on "telega root" page looks reversed (on both t and nil values)

Maybe Telega can guess the correct value depending on running environment (i.e terminal or GUI)? I also found out that the problem is with all RTL language (i.e Arabic and Hebrew as well)

zevlg commented 1 year ago

All these things you are talking about are beyond telega scope

By default bidi has been disabled in chatbufs to not confuse people with RTL nicknames in the public chats.

KaKooDa commented 1 year ago

Okay, but I think it should be added at least to the documentation because there are definitely a lot of RTL Telegram users that are confused like me.