-
-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
incorrect handling of cursor keys with custom keyboard layout #17
Comments
BTW, please also try with home/pgdn/pgup/end, which are mapped to AltGr+yuio (so on a normal us keyboard with this layout you'd press Menu+iop[) |
Does this issue still exists with pluma-1-6.x |
Nope, it's fixed. Great! What's the relevant commit? |
"mark as can be closed" |
I would, but it's not really fixed until we know what's fixed it. Otherwise a future change might unfix it. Documenting this here will help secure the durability of this fix. |
upon more testing, there still is an issue. I misunderstood my original bug report. Selecting text still does not work: if you press shift, and use a key combination which results in cursor movement, text does not get selected. I said the bug was fixed because I misread my bug report, I thought the bug report was that the cursors didn't work at all. They do, however, you just can't select text with shift. |
I have tested this with MATE 1.6 on Arch Linux and can't reproduce the fault you describe. I can select text using SHIFT+CURSORS, SHIFT+PGUP/PGDN and SHIFT+HOME/END. I can also cut with SHIFT+DEL and paste with SHIFT+INSERT. |
Hi flexiondotorg, So to select text to the right one would press and hold Shift, press and hold the ISO Level 3 Shift, and then hold the L key. |
Confirming. Shift selection does not work with custom arrow keys. FWIW, ctrl+arrows works fine. I don't use pluma myself, but I was searching for other victims of improper keyboard handling. See https://superuser.com/a/1000320/521612. @cheater any chance you can contact me so that we can coordinate our efforts? For example, have you already submitted a bug report for Chromium (or any software which is using chromium indirectly e.g. through electron)? Or do you know any other software that has the same bug? Generally, any modern project using latest GTK or QT should work fine by default, and personally I haven't experienced the problem for a long time now. But now that electron is becoming more popular, I have to deal with garbage keyboard handling in chromium, so I'm really interested in getting it fixed. |
Oh. I just noticed something. Arrow keys from If somebody could figure out the difference in what pluma sees when you use arrows with |
OK, so Neo layout is working because it does some magic using You can actually try putting your arrow keys on level five, which will need this:
And also something to do the switching, e.g. I tried it and it does work to some extent. For some reason emacs didn't like this setup, but @bluetech, any chance you can comment on this? I'm sure it will be super helpful. Generally, if I have something like this in my layout:
Am I right to expect that any software is supposed to understand it correctly, including Shift+Left and other combinations? And if so, how can I get this point across to chromium devs, because I have a feeling that “I made a custom keyboard layout and it doesn't work” is not going to fly. |
@AlexDaniel sure, in fact i haven't touched my layout in ages and would love to clean it up if you think you can help. |
@AlexDaniel I would be happy to try and help, but I don't quite get follow what the problem is. Could you summarize for me? The following would be helpful: the keymap being used; expected behavior; actual behavior. |
Hey @bluetech.
When I say “cursor keys”, I mean those keys that are defined in the layout to be cursor keys. For example:
As you can see, If you're wondering how many people actually use this, then you're right, there are probably just a few hundreds of us in the world (users of neo layout not counted because their workaround-ish layout works almost everywhere). That being said, up to date I know only two programs where shift selection does not work: pluma and chromium :) (the situation was much worse a few years ago when all QT apps sucked, but these times are long gone given that it is now fixed upstream). Hey @bluetech, do you want to reproduce the issue on your computer? If so, here's what you can do:
FWIW, I assumed that you use QWERTY so the layout file above was based on it. That said, it's not exactly what I use, but it's exactly what is needed to reproduce the issue. I hope this helps. Let me know if you need more info. |
Which toolkit does pluma use (gtk/qt/something else?). If you don't mind testing a theory, try editing your cursor keys to look like this:
And also (hack for testing) try adding the following line to the
and see how the applications behave. |
Oh, @bluetech. I didn't recognize you at first :) Hello! Thank you for taking a look. Anyway, with both of the suggested changes shift selection starts working in Chromium. What does it tell you? As for pluma, AltGr+Shift+[some key] starts typing the character (e.g. “e”). Without the “preserve” change (with only the first suggested change) I see no difference in both pluma and chromium. |
Also, Pluma seems to be using GTK, but I don't know the details. |
Oh yeah, it's not just Pluma. THREE_LEVEL + preserve makes it work for chromium but breaks it for everything else. |
I don't think i have reported it in chromium but it was a long time ago. |
Right, I see in the
I will need to explain some things. First thing to explain is the concept of "type" in XKB. The "type" of a key group specifies the "shape" of key group (how a specific key behaves when you are in a specific layout). For example the
If a key group is attached this type, it means the key group will have 3 levels, named "Base", "Shift" and "Level3". It is affected only by the modifiers In the keymap symbols file, unless you explicitly specify e.g. Next thing I need to explain is "consumed modifiers". If for example we use the OK, so in the
so of course, if you type
line, you are saying that in e.g.
How do these applications which break behave after this change? |
Thank you so much for your time!
OK, actually that's a very good question. The picture is really not that great now that I look at it. I guess the reason why I never noticed it before is that I normally don't work with text in programs like VLC, but I can still test it if I go to settings and play with some text fields. As for other text editors, it just happened that I never used them before.
The only pattern I can see here is that everything using QT works just fine, and half of the GTK stuff does not. All these were tested without both of the proposed changes, should I do other tests?
As mentioned above, the letter from Level1 is being typed. So I press ralt+shift+e and I get letter “e”. |
I played with your layout a bit (+ making Shift preserved). My conclusion is that GTK3-Wayland regressed here in the handling of consumed modifiers. GTK2 works correctly under Xorg and XWayland. GTK3 works correctly under Xorg (I didn't try XWayland). GTK3 does not work correctly under Wayland. Since pluma uses GTK3, I suggest filing a bug about this in the gnome bugzilla (gtk+ Wayland component). The following API in xkbcommon might be of interest: https://github.com/xkbcommon/libxkbcommon/blob/8db924b87df7fdd40023b55a3ee55558d6fd841e/xkbcommon/xkbcommon.h#L1694 Feel free to cc me on the bug. |
OK, some time has passed since my last reply. The reason is that I'm really confused. You say that both GTK3 and GTK2 should work fine with Xorg, and that GTK3-Wayland is the problem. But I'm not using wayland. The whole wayland problem may be there, but how is it related to me seeing the problem under xorg? 😕 |
Same here, no wayland |
Today, all applications (including pluma and many in the list above marked with ✗) work correctly for me. I remember applying a small fix in my layout, but I think the fix was about using a custom button for Level3 (which fixed other issues), and I think that over the years apps started working properly because of upstream fixes. |
Hi,
when you press shift + cursor key (be it the arrows, pg up/dn or home/end) text should get selected.
I have made a layout in which the cursor keys are only available via alt-gr + hjkl (for the arrows) and yuio (for home, pgdn, pgup, end respectively). When I press those while holding shift the cursor moves, but text doesn't get selected. This is not an issue in e.g. Firefox.
I am assuming the issue happens in upstream as well.
You can reproduce by installing this layout:
https://bitbucket.org/cheater/us_split_cherry_kw6000
Download it, run sudo python install.py, and then select it in the keyboard preferences: go to the tab "by language", select "English", and scroll all the way down to USA Split (Cherry KW 6000/etc etc)
Then, open pluma, and add several lines of text.
Then, select this layout, and press the Menu key (which is mapped to Alt Gr/Level 3) and hjkl to move around like in vim. Note: hjkl are in fact mapped to kl;'. So to move left you press Menu+k, to go right you press Menu+', to go down you press Menu+l, to go up you press Menu+k.
Once you can confidently move the cursor try moving it while holding shift. Text SHOULD become selected, but doesn't.
For an example of where it works, open Firefox and use any text entry control. For example the address bar, or this bug report form. Might work in Chrome too, but I haven't checked.
--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/4318493-incorrect-handling-of-cursor-keys-with-custom-keyboard-layout?utm_campaign=plugin&utm_content=tracker%2F1179776&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F1179776&utm_medium=issues&utm_source=github).The text was updated successfully, but these errors were encountered: