Skip to content
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

Numpad buttons don't work #106

Open
beojan opened this issue Feb 21, 2014 · 10 comments
Open

Numpad buttons don't work #106

beojan opened this issue Feb 21, 2014 · 10 comments

Comments

@beojan
Copy link

beojan commented Feb 21, 2014

In kmscon, the numbers (with numlock on), +, -, *, /, ., and enter keys in the numpad area do not work.

@dvdhrm
Copy link
Owner

dvdhrm commented Feb 21, 2014

What do you mean by "do not work"?

@beojan
Copy link
Author

beojan commented Feb 21, 2014

The number keys, and +, -, /, and * keys produce no output, and the enter key does not execute the command (in the shell).

@dvdhrm
Copy link
Owner

dvdhrm commented Feb 21, 2014

Can you run "make check" which will produce "./test_input". Then run that as root from a command-line and show its output if you press the given keys. And please describe exactly which output happens for which key-presses.

@beojan
Copy link
Author

beojan commented Feb 22, 2014

Strangely, different applications get different keys. ZSH gets nothing as I said above. /bin/login gets the correct keys, as does test_input. VIM, gets letters (p, q, r, s, t, u, v, w, x, and y).

@dvdhrm
Copy link
Owner

dvdhrm commented Feb 23, 2014

Can you please provide the output of ./test_input with a description what was reported on which key-presses?

@beojan
Copy link
Author

beojan commented Feb 23, 2014

sym KP_End
sym KP_Down
sym KP_Next
sym KP_Left
sym KP_Begin
sym KP_Right
sym KP_Home
sym KP_Up
sym KP_Prior
sym KP_Multiply unicode *
sym KP_Subtract unicode -
sym KP_Add unicode +
ym KP_Enter unicode
sym Num_Lock
sym KP_1 unicode 1
sym KP_2 unicode 2
sym KP_3 unicode 3
sym KP_4 unicode 4
sym KP_5 unicode 5
sym KP_6 unicode 6
sym KP_7 unicode 7
sym KP_8 unicode 8
sym KP_9 unicode 9
sym KP_Divide unicode /
sym KP_Multiply unicode *
sym KP_Subtract unicode -
sym KP_Add unicode +
ym KP_Enter unicode
sym KP_0 unicode 0
sym KP_Decimal unicode .

This output is correct. The bug appears to be in how kmscon reports these
keypresses to applications.

On 23 February 2014 15:11, David Herrmann notifications@github.com wrote:

Can you please provide the output of ./test_input with a description
what was reported on which key-presses?

Reply to this email directly or view it on GitHubhttps://github.com//issues/106#issuecomment-35833608
.

@dvdhrm
Copy link
Owner

dvdhrm commented Feb 25, 2014

Yepp, that depends on whether an applications sets the keypad-application-mode or not. This is done in libtsm src/tsm_vte.c in tsm_vte_handle_keyboard(). I'm not sure why that doesn't work as this is afaik the way to report these keys. Sadly, there's no real documentation so I'm not really sure what to do.

The kmscon repository contains a "test_key" program (built by make check). Can you run this in xterm (or your favorite terminal) and tell me what it reports for keypad keys? I have not numpad/keypad so I cannot really test. Sorry..

@beojan
Copy link
Author

beojan commented Apr 7, 2014

Perhaps related, if I start VIM from kmscon, pressing any key puts it into Replace mode.

@apcel
Copy link

apcel commented Dec 22, 2015

Something like that also reproduces in any curses "gui": num-keys work as arrow keys, "/" and "*" are swapped
What info should I attach? Numpad works, as I can see, everywhere except curses. Should I open another issue?

@waveform80
Copy link

I realize this is probably way too late, but just in case anyone else runs across this like I did and spends several days wondering about it: I'm reasonably convinced this isn't a problem in kmscon, or libtsm, but is a problem in zsh (as mentioned by the OP in the comment above).

More specifically it's an issue in a probable extension (like oh-my-zsh or countless others) that use the smkx/rmkx sequences to place the terminal in application mode. Firing up a bash, dash, or a "raw" zsh (with "zsh +d -f") on my system resulted in the keypad working just fine, but it displayed the exact behaviour noted above (right down to the precise same test_input output) under my "usual" zsh environment.

There's a lot more discussion and workarounds to be found, e.g.:

https://superuser.com/questions/742171/zsh-z-shell-numpad-numlock-doesnt-work
http://www.f30.me/2012/10/oh-my-zsh-key-bindings-on-ubuntu-12-10/
ohmyzsh/ohmyzsh#2654
ohmyzsh/ohmyzsh#5113

Some of those may appear Mac OS specific, but it's all the same underlying issue with smkx/rmkx. There's several workarounds to pick from the links above; disable the config setting application mode for zle (zsh's line editor), use bindkey to override the output, or something much more complex (like the PR in the last link). Ultimately though, I think this could be closed as "not a problem in kmscon" (or libtsm for that matter).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants