Bug 192458

Summary: [BiDi/Unicode] Hebrew selection not showing when dynamic word wrap is disabled
Product: [Applications] kate Reporter: Dotan Cohen <kde-2011.08>
Component: generalAssignee: KWrite Developers <kwrite-bugs-null>
Status: RESOLVED WORKSFORME    
Severity: normal CC: christoph, ilmari.lauhakangas, justin.zobel, kde-2011.08, mskco.tp, orgads, sh.yaron, shlomif, uhhadd, waqar.17a
Priority: HI Keywords: rtl
Version: 16.04.1   
Target Milestone: ---   
Platform: Ubuntu   
OS: Unspecified   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Screenshot showing unselected English and Hebrew text
Screenshot showing selected English and Hebrew text
The state when word wrap is on
Selection is correct here
Word wrap is turned off
Here the bug shows
It's impossible to select part of the RTL text
Some UTF text to be used as sample

Description Dotan Cohen 2009-05-12 18:16:56 UTC
Version:            (using KDE 4.2.3)
Installed from:    Ubuntu Packages

When selecting Hebrew text in Kate, the text of the selection is not shown. In fact, there is a portion of the selection that looks unselected right where the Hebrew text should be.

Note that dues to a different bug, Hebrew is left aligned in Kate. However, in the selection, the Hebrew-that-should-be-there is in fact right aligned, as can be seen by the length of the two lines in the screenshots.
Comment 1 Dotan Cohen 2009-05-12 18:17:50 UTC
Created attachment 33587 [details]
Screenshot showing unselected English and Hebrew text
Comment 2 Dotan Cohen 2009-05-12 18:19:14 UTC
Created attachment 33588 [details]
Screenshot showing selected English and Hebrew text
Comment 3 Hamish Rodda 2009-05-21 11:46:30 UTC
It looks like the 2 hebrew lines are being recognised by kate's renderer as RTL lines, but being drawn by the Qt text layout system as LTR; then, kate draws the end of line selection background over them.  Figuring out why kate thinks differently to Qt will be key for this bug.
Comment 4 Shlomi Fish 2010-01-01 22:56:35 UTC
Works fine for me on KDE-4.3.85 (4.4-beta2) on Mandriva Linux Cooker:

<<<<<<<<
Kate
Version 3.3.85
Using KDE Development Platform 4.3.85 (KDE 4.3.85 (KDE 4.4 Beta2))
>>>>>>>>

I can try on VMs contains different KDE versions.
Comment 5 Orgad Shaneh 2010-05-16 10:56:35 UTC
On debian with 4.4.3, it still doesn't work...
Comment 6 Dominik Haumann 2010-05-16 22:22:18 UTC
@Orgad and Dotan: Can you please build the current Kate from gitorious? Here is a simple step-by-step tutorial: http://gitorious.org/kate/pages/Building%20Kate

Please tell us then whether it already works. If not, it would be most awesome if you can provide a patch, since we developers do not use or maybe even understand hebrew text :) Thanks in advance!
Comment 7 Orgad Shaneh 2010-05-16 22:31:27 UTC
I can try (can't promise when :)). I just want to mention the problem is not only in kate, but also in kwrite...
Comment 8 Shlomi Fish 2010-05-17 09:51:49 UTC
(In reply to comment #6)
> @Orgad and Dotan: Can you please build the current Kate from gitorious? Here is
> a simple step-by-step tutorial: http://gitorious.org/kate/pages/Building%20Kate
> 
> Please tell us then whether it already works. If not, it would be most awesome
> if you can provide a patch, since we developers do not use or maybe even
> understand hebrew text :) Thanks in advance!

I should note that I cannot even reproduce this problem here on Mandriva Linux Cooker, and the text selection shows the Hebrew text fine. I can also try that on my Debian Testing VM, and on other VMs, but it may be an Ubuntu-only bug. (Note I speak Hebrew). I should note that you don't need to be intimately familiar with Hebrew to work on this bug, because like Dotan showed the letters simply disappear.
Comment 9 Orgad Shaneh 2010-05-17 10:24:33 UTC
I'm not using ubuntu, but debian testing (with kde 4.4.3 packages from sid).
Comment 10 Shlomi Fish 2010-05-17 13:28:37 UTC
(In reply to comment #9)
> I'm not using ubuntu, but debian testing (with kde 4.4.3 packages from sid).

Hi!

Now I can reproduce it on my Debian Testing VM too. Thanks for the heads up. But it's still OK on Mandriva Cooker.
Comment 11 Orgad Shaneh 2010-06-26 22:57:58 UTC
It is still reproducible in 4.4.4. I've noticed it only occurs if Dynamic Word Wrap is disabled...
Comment 12 Orgad Shaneh 2010-09-01 08:50:55 UTC
Any news?
Comment 13 Shlomi Fish 2011-05-30 11:13:14 UTC
(In reply to comment #12)
> Any news?

Hi Orgad, maybe the workaround I found for it and mentioned here will work for you:

http://shlomif-tech.livejournal.com/58200.html

At least in regards to aligning the Hebrew to the right of the screen.

Regards,

-- Shlomi Fish
Comment 14 Orgad Shaneh 2011-05-30 11:42:16 UTC
Thanks! Read my last comment (#11)... :)
Comment 15 Dominik Haumann 2011-07-20 07:08:42 UTC
If you want to look into this issue: http://kate-editor.org/get-it/

The relevant code piece is probably in the renderer...
Comment 16 Dotan Cohen 2012-05-22 14:15:03 UTC
I can still reproduce this bug in KDE 4.7.4. I can confirm the fact that the bug only appears if Dynamic Word Wrap is disabled.
Comment 17 Christoph Cullmann 2012-11-02 22:31:34 UTC
I guess it is still in KDE 4.8 and 4.9, or?
Could somebody with more knowledge look at this?
Comment 18 Shlomi Fish 2012-11-03 09:39:57 UTC
(In reply to comment #17)
> I guess it is still in KDE 4.8 and 4.9, or?
> Could somebody with more knowledge look at this?

Yes, I can still reproduce this problem in kate-4.9.2-1.mga3 on KDE-4.9.2 on Mageia Linux Cauldron.
Comment 19 Mohammad Sadegh Khoeini 2012-11-03 20:52:54 UTC
Created attachment 74975 [details]
The state when word wrap is on
Comment 20 Mohammad Sadegh Khoeini 2012-11-03 20:53:59 UTC
Created attachment 74976 [details]
Selection is correct here
Comment 21 Mohammad Sadegh Khoeini 2012-11-03 20:54:46 UTC
Created attachment 74977 [details]
Word wrap is turned off
Comment 22 Mohammad Sadegh Khoeini 2012-11-03 20:55:54 UTC
Created attachment 74978 [details]
Here the bug shows
Comment 23 Mohammad Sadegh Khoeini 2012-11-03 20:57:14 UTC
Created attachment 74979 [details]
It's impossible to select part of the RTL text
Comment 24 Christoph Cullmann 2012-11-03 20:59:47 UTC
Could you attach the text from the pictures as UTF-8 txt file, too? ;) Just to have it for reference. Thanks a lot for the detailed description, still not sure how to fix that, anybody some ideas?
Comment 25 Mohammad Sadegh Khoeini 2012-11-03 21:04:07 UTC
I can confirm this bug exists in KDE 4.9.2 on Archlinux.
I also tested it with Persian language and it seems the problem exists only when word wrap is off and the whole line of RTL text is selected.
It is also weird that when you start selecting from an LTR text, you can't leave in the middle of the RTL line and the whole line gets selected.
The text was just some random mixed RTL and LTR text and I got it deleted. However I will submit another sample.
Comment 26 Mohammad Sadegh Khoeini 2012-11-03 21:07:56 UTC
Created attachment 74980 [details]
Some UTF text to be used as sample
Comment 27 Buovjaga 2016-06-14 16:50:58 UTC
Not reproduced with either word wrap on or off. Please re-test.

Arch Linux 64-bit
Kate 16.04.1
KDE Frameworks 5.22.0
Qt 5.6.0
xcb wm
Comment 28 Orgad Shaneh 2016-06-14 17:01:21 UTC
Still reproducable here, when dynamic word wrap is off:

* Debian sid amd64
* Kate 16.04.1
* KDE Frameworks 5.22.0
* Qt 5.5.1
* The xcb windowing system
Comment 29 Buovjaga 2016-06-14 17:06:07 UTC
(In reply to Orgad Shaneh from comment #28)
> Still reproducable here, when dynamic word wrap is off:
> 
> * Debian sid amd64
> * Kate 16.04.1
> * KDE Frameworks 5.22.0
> * Qt 5.5.1
> * The xcb windowing system

Looks like our only difference is Qt version :) Maybe re-test again after Qt 5.6 hits Debian sid.
Comment 30 Shlomi Fish 2016-06-15 10:31:52 UTC
(In reply to Orgad Shaneh from comment #28)
> Still reproducable here, when dynamic word wrap is off:
> 
> * Debian sid amd64
> * Kate 16.04.1
> * KDE Frameworks 5.22.0
> * Qt 5.5.1
> * The xcb windowing system

Still reproducible here, when dynamic word wrap is off:

* Mageia Linux v6 x86-64
* kate-16.04.1-1.mga6
* Qt 5.6.0.
Comment 31 Orgad Shaneh 2016-06-15 20:01:44 UTC
Qt 5.6.1 is here, and the bug still exists...
Comment 32 Christoph Cullmann 2019-07-14 18:44:36 UTC
Yes, still happens :/
Comment 33 Justin Zobel 2020-11-02 01:58:58 UTC
Is someone able to please confirm this is still an issue with Qt 5.14 or above?
Comment 34 Shlomi Fish 2020-11-02 07:43:20 UTC
Hi Justin!

(In reply to Justin Zobel from comment #33)
> Is someone able to please confirm this is still an issue with Qt 5.14 or
> above?

The problem still happens with Qt 5.15.1 on mageia linux v8 x86-64.
Comment 35 Waqar Ahmed 2021-01-23 11:51:39 UTC
There were some changes to the selection behaviour recently, and with the latest master I can't reproduce this anymore.
Comment 36 Janet Blackquill 2022-02-25 22:33:11 UTC
Can't reproduce either anymore. Likely fixed?