Bug 178594

Summary: Kate is useless for editing code which contains hebrew/arabic
Product: [Applications] kate Reporter: Diego Iastrubni <elcuco>
Component: generalAssignee: KWrite Developers <kwrite-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: finex, nadavkav
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Unspecified   
Latest Commit: Version Fixed In:

Description Diego Iastrubni 2008-12-23 20:00:36 UTC
Version:            (using Devel)
Installed from:    Compiled sources

Back in March someone (who shall remain un-named) added to kate a new function which would calculate the "best 
direction" of a paragraph by counting the LTR and RTL chars in that line. 
That is r788729: 
http://websvn.kde.org/trunk/KDE/kdelibs/kate/render/katerenderer.cpp?r1=772931&r2=788729

The last month I found a really ugly "bug" in it. Imagine this php code:

function foo()
{
   $a = "שלום עולם";
   return $a;
}

Now paste it into kate and see what happens. This get funkier when the hebrew 
is inside lists or hashes. IMHO, this renders this "feature" useless - much 
more people will be using kate to code then to write "plain text".

My proposal is detecting the paragraph direction using 
QString::isRightToLeft() and in 4.3 also provide a manual method for setting 
the direction of the paragraph. 

IMHO, this renders kate unusable for editing code.
Comment 1 FiNeX 2008-12-24 12:43:53 UTC
When kate highlight the block code inside { }, the second line disappear :-(
Comment 2 Diego Iastrubni 2009-01-03 18:58:44 UTC
SVN commit 905112 by iastrubni:

Fix for bug 178594, now katepart determinates the direction of each 
paragraph (line) according to the first strong character. 

Since we are no longer using counting chars and not using 
QString::isRightToLeft() (we use a new internal implementation, based
of QString::updateProperties()) we might have a small speed improve: 
now determinating the paragraph direction is done (on average) in O(1) 
instead of O(n) - where n is the length of the string.

BUG: 178594



 M  +15 -12    katerenderer.cpp  
 M  +8 -4      katerenderer.h  


WebSVN link: http://websvn.kde.org/?view=rev&revision=905112
Comment 3 Diego Iastrubni 2009-02-19 22:20:59 UTC
Just as a reference... I asked Ubuntu to backport this issue to KDE 4.1.X. And they did :)

https://bugs.launchpad.net/ubuntu/+source/kde4libs/+bug/314016
Comment 4 Diego Iastrubni 2009-04-24 19:24:12 UTC
*** Bug 175931 has been marked as a duplicate of this bug. ***