numpad keys behaving differently in tmux

46 views
Skip to first unread message

new...@erratt.com

unread,
Feb 22, 2020, 5:30:08 PM2/22/20
to tmux-users
I just recently started working with tmux a bit. I'm currently specifically working to get tintin++ working and have hit a few sticking points that I assume are either related to the tmux config or the tmux/screen terminfo as opposed to xterm.


For profiles I have xterm-256color and tmux-256color.
using ^v to look at what's being sent I see that:
Directly in both terminals an up on the keypad with numlock off is sending ^[[A

However in tintin++ I see \eOx (I assume this is the same as ^[Ox ) when directly from xterm and \e[A (which I assume is equivelant to ^[[A ).

Is there any way for me to overcome this via tmux config/terminfo configuration or does this more likely have something to do with the way tintin++ is looking at the TERM variable or terminfo?

I've not really ever done much with terminfo either so at a bit of a loss currently. Thank you for any help!

Nicholas Marriott

unread,
Feb 22, 2020, 5:58:25 PM2/22/20
to Newlyn Erratt, tmux-users
It's not very clear what you are seeing inside and outside tmux.

tmux sends VT220 sequences when in application keypad mode, that means \eOo for 0, \eOp for 1 and so on. This should be the same as xterm.

This is assuming tmux can itself recognise the keypad keys which depends on the terminal outside sending VT220 sequences (tmux does not use terminfo for this), but xterm should do so.

tmux won't be able to do this with numlock off because IIRC then xterm just sends the normal key sequences, so a keypad Up looks the same as a normal Up (\e[A like you are seeing).

If you are seeing \eOo etc in the application inside tmux, then it must be turning on application keypad mode which makes tmux send these sequences. If it isn't, you should see plain numbers 0-9. If you see \e[A then xterm must be sending a normal Up key.

The tmux-256color terminfo entry doesn't include the keypad keys, so if the application is relying on getting them from terminfo it won't work.

What do you see if you run "cat" then press Up, with numlock on, inside and outside tmux?

What if you do "tput smkx" then do the same?




--
You received this message because you are subscribed to the Google Groups "tmux-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tmux-users+...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/tmux-users/059557af-8346-4793-b901-19a025ac79e1%40googlegroups.com.

new...@erratt.com

unread,
Feb 23, 2020, 2:46:53 AM2/23/20
to tmux-users
My apologies for the lack of clarity. Based on these tests on the keypad

before tput
xterm numpad on sent 8
tmux numpad on sent 8
xterm numpad off sent \e[A
tmux numpad off sent \e[A

after tput
xterm numpad on sent 8
tmux numpad on sent 8
xterm numpad off sent \eOA
tmux numpad off sent \eOA

I believe this is approximately the expected behavior but it still doesn't perform the same once tintin++ is open. I'm almost guessing the tintin++ code is doing something weird with the TERM environment variable but that's just a wild guess since I'm not familiar with this level of detail on terminal things.
> To unsubscribe from this group and stop receiving emails from it, send an email to tmux-...@googlegroups.com.

new...@erratt.com

unread,
Feb 23, 2020, 2:46:58 AM2/23/20
to tmux-users
I may have misspoke. In tintin++ I want \eOx which is sent without tmux but not with. However this doesn't match anything in either set of cat output but I'm obviously not super familiar with escape codes so my apologies if I'm still not being very clear.

On Saturday, February 22, 2020 at 5:58:25 PM UTC-5, Nicholas Marriott wrote:
> To unsubscribe from this group and stop receiving emails from it, send an email to tmux-...@googlegroups.com.

Nicholas Marriott

unread,
Feb 23, 2020, 2:51:29 AM2/23/20
to Newlyn Erratt, tmux-users
Hmm that is very strange. What does "tput smkx|cat -v" show inside and outside tmux?

What tmux version are you using?

To unsubscribe from this group and stop receiving emails from it, send an email to tmux-users+...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/tmux-users/d5f24621-0e9d-4e6f-80ba-6295d41ab080%40googlegroups.com.

topcat

unread,
Feb 23, 2020, 10:32:47 AM2/23/20
to tmux-users
Hi, not sure if this is super useful but I saw something similar when using vim where Ctrl+Home and Ctrl+End wasn't doing the usual thing when run from inside tmux. cat showed the control sequences to be the same in xterm and tmux.

Turns out I was using TERM=screen-256color which makes vim do some strange things. Using xterm256color fixed the problem. So it was not tmux which was the issue (apart from the default TERM) in that case.

new...@erratt.com

unread,
Feb 23, 2020, 11:05:31 AM2/23/20
to tmux-users
Spoke too soon, just tried again and it didn't work. I think maybe I had closed out of tmux before testing. I'm clearly still waking up.

new...@erratt.com

unread,
Feb 23, 2020, 11:05:36 AM2/23/20
to tmux-users
This does do it, though I wonder why screen and tmux don't work when xterm does and if there's a way to fix it

new...@erratt.com

unread,
Feb 23, 2020, 11:05:42 AM2/23/20
to tmux-users
both output ^[[?1h^[=
version 2.6

I should probably also mention I'm using WSL with mintty so it's not actual xterm. Not sure if this could be a factor or not.
> To view this discussion on the web, visit https://groups.google.com/d/msgid/tmux-users/d5f24621-0e9d-4e6f-80ba-6295d41ab080%40googlegroups.com.

Nicholas Marriott

unread,
Feb 23, 2020, 11:16:14 AM2/23/20
to Newlyn Erratt, tmux-users
That looks OK but if the terminal is sending \033OA even after smkx, tmux won't be able to send \033Ox and friends because \033OA is a cursor key sequence not a keypad key.

But it is mysterious that tt++ is able to get it to send keypad sequences unless it is ignoring smkx and sending something else.

Can you run tt++ inside script, outside tmux? Just start it, press a key to make sure you get \033Ox or whatever then quit it and exit script and send me the typescript file.




To unsubscribe from this group and stop receiving emails from it, send an email to tmux-users+...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/tmux-users/51bd5348-0747-4574-a7a6-3314c525897b%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages