Bug 346687

Summary: The Zero-width_non-joiner character does not work.
Product: [Applications] kate Reporter: eMan <eman.amini>
Component: generalAssignee: KWrite Developers <kwrite-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: hamidrjafari, ilmari.lauhakangas, justin.zobel, tsujan2000, vahidrezaborhani
Priority: NOR    
Version First Reported In: 16.04.1   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
URL: http://en.wikipedia.org/wiki/Zero-width_non-joiner
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description eMan 2015-04-26 05:15:05 UTC
It is essential for all people who write with Arabic scripts to be able to insert http://en.wikipedia.org/wiki/Zero-width_non-joiner character. But it doesn't work in kate. It used to work correctly but for now there is problem.

Reproducible: Always

Steps to Reproduce:
1. write some Arabic script like: می خواهم
2. I must add Zero-width_non-joiner character between می and خواهم instead of regular SPACE with SHIFT+SPACE
3. But when I press SHIFT + SPACE it prints the regular SPACE, not Zero-width_non-joiner character.

Actual Results:  
 it prints the regular SPACE, not ZWNJ character.

Expected Results:  
It should add ZWNJ character when I press SHIFT+SPACE together
Comment 1 Buovjaga 2016-06-25 13:21:39 UTC
Confirmed.

Arch Linux 64-bit
Kate 16.04.2
KDE Frameworks 5.23.0
Qt 5.7
xcb wm
Comment 2 Hamidreza Jafari 2017-10-26 19:26:14 UTC
In general it was a Qt bug in KDE which is fixed now. It seems some parts of Kate are still in the old implementation and have not switched to update. It could be a simple refactoring if no other type of bug.

I am using Kubuntu hence it also affects Ubuntu packages.

More info:
https://bugreports.qt.io/browse/QTBUG-42074
Comment 3 Tsu Jan 2017-10-26 19:51:44 UTC
The issue is in Kate's view. The search line-edit, for example, is OK now because the same issue is fixed in Qt-5.9.
Comment 4 Christoph Feck 2017-11-09 01:07:20 UTC
The Gerrit code changes from the link in comment #2 could give some inspirations for a fix in Kate.
Comment 5 Tsu Jan 2017-11-09 01:26:25 UTC
> could give some inspirations for a fix in Kate

Don't know about Kate's code but, for example, inside keyPressEvent(QKeyEvent *event) this can be done for a text-edit:

if (event->key() == 0x200c)
{
    insertPlainText (QChar (0x200C));
    event->accept();
    return;
}

It shouldn't be needed after the Qt fix but, apparently, Kate's behavior is different from that of QPlainTextEdit.
Comment 6 Justin Zobel 2020-11-02 02:17:14 UTC
(In reply to Tsu Jan from comment #5)
> > could give some inspirations for a fix in Kate
> 
> Don't know about Kate's code but, for example, inside
> keyPressEvent(QKeyEvent *event) this can be done for a text-edit:
> 
> if (event->key() == 0x200c)
> {
>     insertPlainText (QChar (0x200C));
>     event->accept();
>     return;
> }
> 
> It shouldn't be needed after the Qt fix but, apparently, Kate's behavior is
> different from that of QPlainTextEdit.

Hi Tsu can you please confirm if this issue is fixed now that we're on a later Qt version?
Comment 7 Tsu Jan 2020-11-02 11:14:56 UTC
Yes, this was a Qt issue. It was fixed a long time ago, after this old report.

The Zero-width_non-joiner character is OK.