Bug 475043

Summary: Problem with Bidi text
Product: [Applications] Tokodon Reporter: Sohrab Behdani <behdanisohrab>
Component: generalAssignee: Unassigned bugs mailing-list <unassigned-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: carl, josh, uhhadd
Priority: NOR Keywords: rtl
Version: 23.08.1   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In: 24.02
Sentry Crash Report:
Attachments: Issue screenshot

Description Sohrab Behdani 2023-09-30 10:56:37 UTC
Created attachment 161969 [details]
Issue screenshot

SUMMARY
***
Hello, there is a problem with tokodon when showing bidi text. when it starts with LTR languages such as english and then somthing like persian it became all LTR and vise versa.

i had attached a screenshot for this issue
***

Plasma 5.27.8 on Arch Linux
Comment 1 Joshua Goins 2023-10-02 11:42:15 UTC
Confirmed, I'll see if this is something we can fix on our end
Comment 2 Joshua Goins 2023-10-03 20:56:54 UTC
So I managed to fix this, but making it mixed with LTR  languages like English is going to be difficult for now (but not unsolvable)...

What's the better solution here: keep it LTR if it detects English or keep it RTL with English also being shifted? If it's the latter, I can submit my fix :)
Comment 3 Sohrab Behdani 2023-10-05 08:54:01 UTC
(In reply to Joshua Goins from comment #2)
> So I managed to fix this, but making it mixed with LTR  languages like
> English is going to be difficult for now (but not unsolvable)...
> 
> What's the better solution here: keep it LTR if it detects English or keep
> it RTL with English also being shifted? If it's the latter, I can submit my
> fix :)

thanks, but in my language we use some foreign words from other languages and our toots could be a mixture of persian and english words.
in markdown we use direction = auto to make things stay in their position.

i guess it could help you too.
Comment 4 Joshua Goins 2023-11-08 20:01:40 UTC
After talking to some other people about it, I have a solution but it won't be implemented anytime soon. It would chop up the paragraphs so that rtl text wouldn't be mixed with ltr text, similar to how it looks on websites and markdown.
Comment 5 Bug Janitor Service 2024-01-24 05:11:37 UTC
A possibly relevant merge request was started @ https://invent.kde.org/network/tokodon/-/merge_requests/462
Comment 6 Janet Blackquill 2024-01-24 16:03:23 UTC
Git commit 3d6f5ff58604978e4d85d201078c69bc3acd900b by Janet Blackquill.
Committed on 24/01/2024 at 17:03.
Pushed by jblackquill into branch 'release/24.02'.

PostContent: assorted bidirectionality fixes

- turn mentions into bidirectional isolates which makes them work nicer inline in RtL
- split apart <br/> into text blocks, which allows each line to have its own direction like other platforms render them
(cherry picked from commit 80eb1b3e35a3dfa60deff6a53a2ad53f9536a396)

M  +2    -0    src/CMakeLists.txt
M  +1    -6    src/content/ui/StatusDelegate/PostContent.qml
M  +1    -1    src/utils/clipboard.cpp
A  +75   -0    src/utils/textpreprocessing.cpp     [License: LGPL(v2.0+)]
A  +25   -0    src/utils/textpreprocessing.h     [License: LGPL(v2.0+)]

https://invent.kde.org/network/tokodon/-/commit/3d6f5ff58604978e4d85d201078c69bc3acd900b