Scrolling with keys on numeric keypad with num lock off

已回答

Hi all

I have PhpStorm 6.0 running on Ubuntu 12.04 on a big HP laptop which has a full size keyboard, including a normal numeric keypad on the right. The arrow keys in the main part of the keyboard are small and inconvenient to use. I would like to use the arrows keys that are part of the numeric key pad.

The keys on the numeric keypad normally produce numbers of course but if I hit num lock so num lock is off they become arrow keys. The problem is that in PhpStorm, they scroll the whole edit window up and down rather than move the cursor.

Is there any setting that can change this? I don't know if the problem is specific to this hardware, Ubuntu or what but in other applications such as gedit, Libre Office or a textarea on a web form, the keypad arrow keys work as I want, i.e., they move just the cursor, not the whole window. I've tried the two checkboxes in PhpStorm that are related to scrolling but that doesn't help.

Thanks for a great product.

1

Hi there,

Settings | Keymap

Customize keys as you want. Quite likely that numeric keypad keys are assigned to different actions as normal arrow keys.

Hint: the "search by shortcut" functionality is available (the button on the right to search field) -- use it.

0
Avatar
Permanently deleted user

Thanks Andriy, I'm looking at that now but something is a bit weird.

When I use the "Find Actions by shortcut" box, the dedicated arrow keys and the numeric keypad arrow keys (num lock off) produce the same code. The both say Up, Down, Left or Right so I can't distinguish between those two sets of keys. They should produce the same result but when I'm in the editor, they don't. The editor seems to intepret those keys differently to the Settings | Keymap.

I have a pretty standard installation, I don't think I have anything weird affecting key codes.

1
Avatar
Permanently deleted user

One more thing to note.

On the left side on the screen where I have my project open, those numeric keypad arrows do work like normal arrows keys. I can use them to navigate up and down my directories. But ... over in the edit window they work as if I was holding down the ctrl key because ctrl down is mapped to scroll down etc.

1

I do not know then.

I never had such problem .. but I'm on Windows. But I definitely remember seeing somewhere else when the person complained about similar behaviour  (also on Linux), and I he/she fixed it by altering shortcuts in keymap.

Maybe somebody else who uses Linux can give you useful advice here.

0
Avatar
Permanently deleted user

I had the same problem on Ubuntu 13.10 and phpStorm 7.1.3.
To make the numpad buttons behave like navigational I did the keymap reassignment.

Go to File | Settings search for Keymap. Then at the right panel in the Editor Actions reassign Up, Right, Down, Left actions. Search for Up, right click and select Add Keyboard Shortcut. Then press any button and again press numpad Up button. Do the same thing for Right, Down and Left actions.

After reassigning the numpad buttons behave like navigation buttons.

To get Shift+Numpad buttons working like Shift+Arrows for code selection, repeat the same reassigning with actions Up with Selection, Right with Selection, Down with Selection, Left with Selection.

5
Avatar
Permanently deleted user

Thank you Jevgenijs Saltish. I had this problem on Ubuntu with my old IBM AT keyboard (which doesn't even have dedicated arrow keys), and your detailed answer was exactly what I needed to get my numpad arrows working.

Thanks!

0
Avatar
Permanently deleted user

It's 2018 and this bug hasn't been fixed yet.

3
Avatar
Permanently deleted user

The solution here works fine for all of the numpad keys except the delete key.

On linux, the numpad delete key is interpreted as "Period" and there is no way to distinguish it from the normal "Period" button.

This issue really grinds my gears. There's nothing quite like optimizing your work environment for years and then just finding out that optimization is not possible in a new environment.

1
Avatar
Permanently deleted user

Other editors in Ubuntu 18.x work correctly - and distinguish the keys correctly - e.g. VS Code.

This should be fixed.

The editor clearly cannot see the arrows at all (on numpad).

There is no way to edit the keymap because it doesn't distinguish - so cannot associate actions to numpad keys.

This is awful - I'm a total addict to my numpad keys - editing is just not possible w/o them.

PS: It's 1/2 way through 2019....

1

I am really enjoying using PyCharm and finding is a  great and most useful app.  However, since moving from Windows (where I got used to using the number pad key pad as arrow keys) to Ubuntu Linux (where certain apps don't seem to recognize the arrow keys in the same way) I have felt slightly frustrated.  

PyCharm has some wonderful keyboard customization features.  By default I find, for example that the "Left" arrow key is mapped to the "Left function" as one would expect, however if I try to map an additional Keypad-Left key then it seems that the PyCharm already interprets this as a "Left" key, so I don't see why this doesn't work - there us obviously something different about the message sent by the "Left" key and the "Keypad Left" key.

Although I don't understand why the above doen't work, I have found that the following solution by Peter L does work for me which I copied from....

Physical keys on a keyboard are mapped to key codes using xkb. Here's how I got numeric keys working with java applications (like Intellij) on a Debian derivative of Linux:

Here's how I got numeric keys working with java applications (like Intellij) on a Debian derivative of Linux:

  1. Switch to root user
  2. cd /usr/share/X11/xkb/symbols
  3. cp keypad keypad.original (just in case)
  4. Edit keypad and replace all occurrences of KP_Up, KP_Down, KP_Left & KP_Right with Up, Down, Left & Right, respectively
  5. Save
  6. dpkg-reconfigure xkb-data
  7. Reboot

Now the numeric keypad will emit the regular, arrow, key codes and not the java-unrecognised, numeric keypad, arrow, key codes.

 

 

 

0

It appears in concert with the previous comment, that the underlying reason is that the keypad key codes for the numpad arrows are by default different on some (most?)  linux distributions than on Windows, and therefore the workaround in IntelliJ keymap settings is required. It might be worth including this information more explicitly to make this issue less bewildering. 

0

请先登录再写评论。