Bug 178594 - Kate is useless for editing code which contains hebrew/arabic
Summary: Kate is useless for editing code which contains hebrew/arabic
Alias: None
Product: kate
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Unspecified
: NOR normal
Target Milestone: ---
Assignee: KWrite Developers
: 175931 (view as bug list)
Depends on:
Reported: 2008-12-23 20:00 UTC by Diego Iastrubni
Modified: 2009-04-24 19:24 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Note You need to log in before you can comment on or make changes to this bug.
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: 

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 :)

Comment 4 Diego Iastrubni 2009-04-24 19:24:12 UTC
*** Bug 175931 has been marked as a duplicate of this bug. ***