Bug 438755 - shaped (arabic) text messed after being selected (or highlighted by search)
Summary: shaped (arabic) text messed after being selected (or highlighted by search)
Status: RESOLVED FIXED
Alias: None
Product: kate
Classification: Applications
Component: general (other bugs)
Version First Reported In: 20.12.2
Platform: Debian testing Linux
: NOR normal
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-06-16 17:20 UTC by Usama Makhzoum
Modified: 2023-04-04 19:41 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments
a screenshot that demonstrates the bug (70.28 KB, image/png)
2021-06-16 17:20 UTC, Usama Makhzoum
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Usama Makhzoum 2021-06-16 17:20:57 UTC
Created attachment 139403 [details]
a screenshot that demonstrates the bug

shaped (may be just arabic) text messed after being selected (or highlighted by search), it displays fine when deselect

STEPS TO REPRODUCE
1. write some arabic text, example: مثال
2. select it


OBSERVED RESULT
messed up (the final glaph lose its context, so it change its shape and make reader think it is another word)

EXPECTED RESULT
should not change its shape

SOFTWARE/OS VERSIONS
Linux/KDE Plasma:
(available in About System) *I could get them it is not mentioned because of some reason so I will get versions from APT*
KDE Plasma Version: 
5.20.5
KDE Frameworks Version: 
5.78.0
Qt Version: 
5.15.2
ADDITIONAL INFORMATION
I attached a screenshot, it will make everything clear
Comment 1 Usama Makhzoum 2021-06-16 17:44:16 UTC
KDE Frameworks 5.78.0
Qt 5.15.2 (built against 5.15.2)
The xcb windowing system
Comment 2 Waqar Ahmed 2022-03-22 15:16:45 UTC
confirmed
Comment 3 Waqar Ahmed 2022-07-06 06:53:02 UTC
needs to be fixed in upstream qt.
Comment 4 Waqar Ahmed 2023-03-22 15:48:33 UTC
Reopening as it is fixable in KTE

Regardless it would be better to get this fixed in Qt.
Comment 5 Bug Janitor Service 2023-03-23 13:12:03 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/ktexteditor/-/merge_requests/515
Comment 6 Christoph Cullmann 2023-03-24 10:03:37 UTC
Git commit 9394bcede083e0973c27b57422327f0f647d1c5b by Christoph Cullmann, on behalf of Waqar Ahmed.
Committed on 24/03/2023 at 09:56.
Pushed by cullmann into branch 'master'.

Fix RTL text with format incorrectly shaped

This fix is a work around the bug in Qt. Ideally it should be fixed there
but we can do what is possible here.

The problem is mentioned in details in the comments of this script.
Short version is that Qt's text shaping code is naive. It breaks
the text into boundaries which make no sense and this leads to bad
results.

We can also fix this for Foreground text/Underlines etc but lets
see if we get a bug for that first.

M  +61   -5    src/render/katerenderer.cpp
M  +1    -1    src/render/katerenderer.h

https://invent.kde.org/frameworks/ktexteditor/commit/9394bcede083e0973c27b57422327f0f647d1c5b
Comment 7 Waqar Ahmed 2023-04-04 19:41:58 UTC
Git commit 3fa5182f2738561dfaf7ec2a69f1d8b5fed73a95 by Waqar Ahmed.
Committed on 04/04/2023 at 18:55.
Pushed by cullmann into branch 'kf5'.

Fix RTL text with format incorrectly shaped

This fix is a work around the bug in Qt. Ideally it should be fixed there
but we can do what is possible here.

The problem is mentioned in details in the comments of this script.
Short version is that Qt's text shaping code is naive. It breaks
the text into boundaries which make no sense and this leads to bad
results.

We can also fix this for Foreground text/Underlines etc but lets
see if we get a bug for that first.

M  +61   -5    src/render/katerenderer.cpp
M  +1    -1    src/render/katerenderer.h

https://invent.kde.org/frameworks/ktexteditor/commit/3fa5182f2738561dfaf7ec2a69f1d8b5fed73a95