Bug 280645

Summary: [BiDi/Unicode] If the BiDi algorithms is too complicated to maintain, why not to support the simple one???
Product: [Frameworks and Libraries] frameworks-ktexteditor Reporter: Nadav <nadavvin>
Component: generalAssignee: KWrite Developers <kwrite-bugs-null>
Status: RESOLVED FIXED    
Severity: wishlist CC: avidseeker7, christoph, elcuco, safa1996alfulaij, waqar.17a
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Nadav 2011-08-23 13:46:15 UTC
Version:           unspecified (using KDE 4.7.0) 
OS:                Linux

If it's hard for only one direction language speaker to maintain good bidi algorithms why not support the simple which Mozilla and Microsft use: key for choose the direction (in windows ctrl+shift align the text to the direction that the keys on the keybords or from "Switch Text Direction" in Mozilla.

Currently kwrite and kate have only left to right direction...

Reproducible: Always

Steps to Reproduce:
write rtl text in kwrite/kate

Actual Results:  
the text written in left

Expected Results:  
the text written in right.

add button or key combination that change the direction
Comment 1 Nadav 2011-08-23 13:47:40 UTC
Also support CTRL+SHIFT will help windows user migrate to KDE more quickly
Comment 2 Nadav 2011-08-23 13:51:52 UTC
and it might will save bugs in style this one:
https://bugs.kde.org/show_bug.cgi?id=246162
Comment 3 Dominik Haumann 2011-09-16 15:32:38 UTC
Can you send a patch? :-)
Comment 4 Diego Iastrubni 2012-11-05 21:20:29 UTC
See also https://bugs.kde.org/show_bug.cgi?id=187408

(this one talks about users been able to specific manually the direction of the paragraph, the other one talks about the automatic direction detection)
Comment 5 Safa Alfulaij 2016-06-20 18:10:41 UTC
I don't see any use of making such a button. The current implementation of bidi text is quite fine.

Word-wrap (off):
All the text is aligned to left, while the direction of each is correct. RTL text have RTL direction, and LTR text have LTR direction.
Word-wrap (on):
Text is aligned depending on it's direction. So Arabic/Hebrew text is aligned to right, and English text is aligned to left. And the text direction of both is correct.

To conclude:
Direction-ality is reserved for both RTL and LTR text. Just the alignment differs and that's totally fine.
Comment 6 Diego Iastrubni 2016-06-20 18:52:14 UTC
Safa, that is not correct. In our current implementation, direction=alignment.

That said, I do see some scenarios in which "first strong character of paragraph" fails as an algorithm.
Comment 7 Safa Alfulaij 2016-06-20 19:17:48 UTC
(In reply to Diego Iastrubni from comment #6)
> Safa, that is not correct. In our current implementation,
> direction=alignment.
> 
> That said, I do see some scenarios in which "first strong character of
> paragraph" fails as an algorithm.

Here you are, some screenshots :)
This is in Windows, but it's the exact same in ArchLinux (Kate 16.04.1, Qt 5.6, KF 5.22)

Word-wrap on: http://i.imgur.com/3uxv2vK.png
Word-wrap off: http://i.imgur.com/L8B8dDG.png

And this is Windows notepad where alignment=direction:
RTL text order active: http://i.imgur.com/76XnPma.png
RTL text order inactive: http://i.imgur.com/1QaH4gw.png
Comment 8 Christoph Cullmann 2019-05-19 15:02:09 UTC
Dear user, this wish list item is now closed, as it wasn't touched in the last year and no contributor stepped up to implement it.

The Kate/KTextEditor team is small and we can just try to keep up with fixing bugs.

Therefore wishes that show no activity for a years or more will be closed from now on to keep at least a bit overview about 'current' wishs of the users.
If you want your feature to be implemented, please step up to provide some patch for it.

If you think it is really needed, you can reopen your request, but keep in mind,
if no new good arguments are made and no people get attracted to help out to implement it,
it will expire in a year again.

We have a nice website https://kate-editor.org that provides all the information needed to contribute, please make use of it.

Patches can be handed in via https://phabricator.kde.org/differential/

Greetings
Christoph Cullmann
Comment 10 Waqar Ahmed 2023-04-06 12:50:08 UTC
Fixed now.

To force RTL direction, "View -> Force RTL Directino"

To force LTR directino, disable dynamic wrapping.
Comment 11 AvidSeeker 2024-05-27 05:53:30 UTC
Thank you for your work. I just tested the feature on kate 24.02.2 and it works. However, RTL and LTR text directions are mutually exclusive. It doesn't make sense to have it as a checkbox instead of a toggle.

This makes the common operation of switching directions hard to reach. Compare this with how other programs implement it like Firefox where it is only a single shortcut that toggles the text direction: Ctrl+Shift+X.