One of the best things about Qt4 is it’s great support for non Latin scripts. The classes are called “The Scribe Classes” and they are well documented in Qt4’s documentation. katePart has been ported to use those classes in a very early stage, and in theory kate4/kwrite4 should support BiDi in a very good way. In practice it is not the case.
In practice, the direction of the paragraphs was inherited by the layout system. This means that if you are using kwrite in RTL mode (in Hebrew or Arabic user interface, or just passing the –reverse command line) text (specially code, wich is damn ugly!) will be displayed in RTL mode, which is bad. Another bad thing is that RTL paragraphs are not right aligned (the direction was RTL but they were left aligned) and this is also bad.
The fix was actually pretty trivial, when you sit and learn how Qt4 handles text, and I already commited it to the SVN and it will be part of KDE4.1. I also coded a new method which tries to detect the best direction for the paragraph not based on the first strong character, but it scans the whole line, and detects which language is more dominant in that paragraph/line. We have this code in konversation (KDE3) and Thomas Zander has implemented it also in KWord (KDE4), so I think it’s tested enough and safe to use.
As always, mandatory screen shot: