Bug 329370

Summary: Can’t input certain letters (accented letters that, in bépo, are located at the same spot as a letter in QWERTY)
Product: [Applications] kate Reporter: Sami Boukortt <sami>
Component: Vi Input ModeAssignee: KWrite Developers <kwrite-bugs-null>
Status: RESOLVED FIXED    
Severity: major CC: michal.humpula, renan.fargetton
Priority: NOR    
Version: 3.12.0   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: quick test fix
better fix
altgr cleanup

Description Sami Boukortt 2013-12-29 15:20:42 UTC
I use the bépo keyboard layout (http://bepo.fr/ ) and while most letters can be entered in insert mode (even ê (bottom left) and ç (far right)), é results in w instead, è in t and à in z.

Reproducible: Always

Steps to Reproduce:
1. Use the bépo keyboard layout (`setxkbmap fr bepo`)
2. Activate the vi input mode of Kate
3. Try to input one of: é, è, à
Actual Results:  
If one of those keys is pressed, the actual letter that appears is the letter that would have been obtained in QWERTY.

Expected Results:  
Pressing a key should always input the correct character.

In previous versions of Kate, a similar behaviour could be observed when using the `r` command but the insert mode worked correctly.

The bug only happens if the vi input mode is enabled.
Comment 1 Michal Humpula 2013-12-29 15:31:24 UTC

*** This bug has been marked as a duplicate of bug 298726 ***
Comment 2 Sami Boukortt 2013-12-29 16:11:05 UTC
Sorry, I hadn’t found that one.

I have just tried to apply the patch to the current stable version. It applies and builds correctly, and I can confim that the bug is solved. Thanks!
Comment 3 Sami Boukortt 2013-12-29 16:14:56 UTC
Hm, actually, it has broken every character that needs Shift+Alt Gr.

Should I open a separate bug?
Comment 4 Michal Humpula 2013-12-29 16:25:04 UTC
Hi Sami,

thanks for addition. As for the AltGr keys... they are "marked" as broken:) And there is one bugreport, which indirectly blames AltGr, already. So, let's not open another issue. I will come back here with the patch for that (I know which line is guilty).
Comment 5 Michal Humpula 2013-12-29 16:54:45 UTC
Created attachment 84326 [details]
quick test fix

if you can, try to compile with this additional patch please. This removes all the special altgr handling from the vi-mode. From the test on my computer I'm now able to input the altgr characters.
Comment 6 Sami Boukortt 2013-12-29 17:09:15 UTC
It doesn’t appear to change much. Alt Gr characters still work, Shift+Alt Gr characters still don’t (some Shift+Alt Gr *dead* keys seem to work, however).

Thank you for trying, though. :)
Comment 7 Michal Humpula 2013-12-29 20:23:54 UTC
Created attachment 84329 [details]
better fix

my bad, I wanted to be too easy. AltGr is difficult:( This one, goes other way around. Now I'm able to write the upper case AltGr keys, but the keys are not recorder properly, so you want get an repeat. If you are ok with it, I would call it done.
Comment 8 Sami Boukortt 2013-12-29 22:34:53 UTC
It seems to work perfectly. Thank you very much!
Comment 9 Michal Humpula 2013-12-30 10:56:55 UTC
Git commit d6820b725de61227f2c373c876c2f4925ba76af4 by Michal Humpula.
Committed on 29/12/2013 at 20:19.
Pushed by michalhumpula into branch 'master'.

vi-mode: make AltGr enabled keyboards work

... mostly ...
Related: bug 314265
REVIEW: 114734

M  +6    -0    part/view/kateviewinternal.cpp
M  +15   -0    part/vimode/kateviinputmodemanager.cpp
M  +2    -0    part/vimode/kateviinputmodemanager.h
M  +1    -2    part/vimode/katevikeyparser.cpp
M  +0    -5    part/vimode/katevinormalmode.cpp
M  +44   -19   tests/vimode_test.cpp
M  +1    -0    tests/vimode_test.h

http://commits.kde.org/kate/d6820b725de61227f2c373c876c2f4925ba76af4
Comment 10 Sami Boukortt 2014-01-04 15:12:34 UTC
Unfortunately, the patch appears to introduce a new bug: whenever I enter a thin non-breaking space (U+202F, Alt Gr + Shift + Space with bépo), keys such as Backspace, Delete, Escape or arrow keys stop working until I restart Kate.

Only that character has triggered that bug so far.
Comment 11 Sami Boukortt 2014-01-06 12:50:28 UTC
Strangely enough, the regression only occurs on one of my two machines.
Comment 12 Michal Humpula 2014-01-07 14:30:46 UTC
Created attachment 84500 [details]
altgr cleanup

Hi Sami, would you be willing to test this micropatch? It cleans the flow of altgr a little bit more (though it may break another layouts or break on older Qt(?)).

I think the reason, why the space breaks everything is that I don't see AltGr key release event with the space as is usual with other keys. So the internal state is messed up after that. The patch simple switches from AltGr key monitor to key modifiers flags.
Comment 13 Sami Boukortt 2014-01-07 17:05:00 UTC
Hi, thank you very much for taking the time to look into this.

I won’t be able to test the patch before Friday (as I’m not using the machine on which the bug is reproducible) but I will definitely try it then.
Comment 14 Sami Boukortt 2014-01-10 17:12:25 UTC
It appears to fix the problem. Thanks a lot!
Comment 15 Michal Humpula 2014-01-11 17:32:28 UTC
Git commit 14886143280062d62c69c207a3472167c448b430 by Michal Humpula.
Committed on 07/01/2014 at 15:06.
Pushed by michalhumpula into branch 'master'.

vi-mode: remove obsolete AltGr state tracking

REVIEW: 114965

M  +0    -6    part/view/kateviewinternal.cpp
M  +1    -12   part/vimode/kateviinputmodemanager.cpp
M  +0    -2    part/vimode/kateviinputmodemanager.h
M  +3    -3    part/vimode/katevikeyparser.cpp
M  +0    -4    part/vimode/katevikeyparser.h

http://commits.kde.org/kate/14886143280062d62c69c207a3472167c448b430