Bug 345504

Summary: Numeric Keypad arrow keys not working
Product: [Applications] kate Reporter: Andries <andriesehlers>
Component: applicationAssignee: KWrite Developers <kwrite-bugs-null>
Status: RESOLVED UPSTREAM    
Severity: normal CC: aeon.descriptor, andysem, bodom, cullmann, davidsboogs, kare.sars, luislezcair, pyrkosz, stevegorwood, theo.steininger
Priority: NOR    
Version: 5.0.0   
Target Milestone: ---   
Platform: Kubuntu   
OS: Linux   
Latest Commit: Version Fixed In:

Description Andries 2015-03-25 08:48:47 UTC
Cannot navigate the cursor with the numeric keypad while editing in Kate - the numeric arrows (when numlock is off) does not work.  Also, although "numeric keypad should function like in MS Windows" is selected in KDE settings, I cannot quick-select text by pressing SHIFT+HOME or SHIFT+END to highlight a line.

When numlock is on, I can use numeric keypad for number input.

The above-mentioned functionality works perfectly through KDE and other apps.

Reproducible: Always

Steps to Reproduce:
1. Open kate
2. Type any sentence
3. Ensure numlock is off.
4.1  try to move cursor with numeric arrow keys - not working
4.2  try to highlight a line (from start or end) by pressing SHIFT+HOME or SHIFT+END

Actual Results:  
Nothing happens - when numlock is off, its as if Kate does not know that numeric keypad exists.


Tried with both laptop keyboard (has built-in numeric keypad) and plugged in USB keyboard - neither works.  Both work for the rest of KDE though.
Comment 1 Brian 2015-04-08 15:34:41 UTC
I can confirm this is an issue for me, too, in Ubuntu 15.04 / Plasma 5.2.2 / Qt 5.4.1.  Also, I can confirm that this is not an issue in other applications (including other KDE applications) for me, such as Firefox, LibreOffice, KMail, and Yakuake.

My system is a crossover from Ubuntu-Gnome by installing the kubuntu-desktop package.

I've noticed that both FCITX and IBUS are running.  I have absolutely no idea whether or not this would have *any* effect whatsoever, it's juts an oddity I thought I'd note in case it has any effect.
Comment 2 Luis Lezcano Airaldi 2015-04-10 23:10:41 UTC
I have the same issue on Arch Linux with Kate 5.0.0 / KDE Frameworks 5.8 / Qt 5.4.1

I tried changing the mappings and some keyboard settings in systemsettings but it didn't work.
Comment 3 Luis Lezcano Airaldi 2015-04-27 14:58:55 UTC
I also found that the shortcuts are not saved when setting both a main and alternate shortcut, so I think this bug might be related to https://bugs.kde.org/show_bug.cgi?id=343665
Comment 4 raimo 2015-05-15 14:42:26 UTC
Same happends to me (in two machines). Its very a frustrating when fingers allways hits those keys as a "brain-automatically" and nothing happends.  Ins (0) and Del (,) did not work either. 

Kate is 5.0.0 and Kubuntu 15.04 in use.

Please fix this!
Comment 5 theo.steininger 2015-05-22 10:10:56 UTC
Having the problem, too, on Kubuntu 15.04.
Comment 6 David 2015-07-20 18:43:50 UTC
My laptop doesn't have physically separate Home and End keys, so I rely on always keeping Numlock off and using the keypad. This is a very serious usability issue for me. Haven't there been enough reports to at least Confirm this bug?
Comment 7 pyrkosz 2015-08-09 20:45:29 UTC
Same in KWrite 5.0.0 on Kubuntu 15.04 - very frustrating bug.
Comment 8 pablitar.android 2015-08-11 18:50:14 UTC
*** This bug has been confirmed by popular vote. ***
Comment 9 Christoph Cullmann 2015-08-11 19:33:51 UTC
I am very sorry for your inconveniences, but I can't reproduce that at all with current KF5 based Kate/KWrite.
Comment 10 stevegorwood 2015-08-15 01:30:34 UTC
I also see the problem on a system running NetRunner Osmandias with both kwrite and kate.

One hint, perhaps,  The navigation keys DO work when in VI input mode.  They do not work in Normal Input mode.
Comment 11 Kåre Särs 2015-08-15 07:25:52 UTC
I can reproduce this on Kubuntu and KF5 HEAD

I have done a couple of minutes investigation into this and I suspect that the Qt::KeypadModifier might be the root of the problem.
Comment 12 Kåre Särs 2015-08-16 19:12:11 UTC
I think I was right about Qt::KeypadModifier :)

The thing is, cursor movement is handled by shortcuts set up in KTextEditor::ViewPrivate::setupEditActions()
Here up/down/... is assigned a QAction with it's default shortcut Qt::Key_Up/Qt::Key_Down/...
Now on Kubuntu, and Swedish layout at least, the numeric key pad buttons come as Qt::Qt::KeypadModifier+Qt::Key_... This means that they do not match the shortcut and do not trigger the slots.

I have tried adding more actions with the modifier and it works, but then we would have to duplicate all key-combinations also :( The same holds if we just add alternate shortcuts. It is doable but not nice.

I also tried to play around with the event handler to just remove the modifier, but I have not succeeded  yet to get the actions triggered.

I wonder why these are actions and not handled in keyPressEvent()...
Comment 13 Kåre Särs 2015-08-18 19:45:36 UTC
I when through all the edit actions and added alternate shortcuts, but then the shortcuts from scripting still do not work... And then thinking if this really is a Qt bug as it used to wok in Qt4, I looked around and found https://bugreports.qt.io/browse/QTBUG-33093 and https://codereview.qt-project.org/#/c/95219/ which was merged today to Qt5.5 (could be included in the 5.5.1 release).
Comment 14 Kåre Särs 2015-09-16 19:41:38 UTC
*** Bug 352810 has been marked as a duplicate of this bug. ***
Comment 15 Kåre Särs 2015-09-20 09:57:51 UTC
*** Bug 352936 has been marked as a duplicate of this bug. ***
Comment 16 Gabriele Tozzi 2015-09-20 10:34:53 UTC
I've been reading all of this and now I'm confused.
Which version of kate has this bug been fixed on? Where can I get it?

Thank you
Comment 17 Kåre Särs 2015-09-20 11:19:35 UTC
It is a bug in Qt not Kate. The reason it works in some KDE applications is that they use keypress events directly and not QAction shortcuts. So you have to update the Qt version to at least 5.5.1 (which is not released yet at the time of writing)