Subject: bug#16645: 24.3; in xterm, keypad = is translated to M-o x

From: Vincent Lefevre <[email-masked]>
Date: Tue, 7 Sep 2021 11:53:52 +0200

On 2021-09-06 11:36:10 +0200, Lars Ingebrigtsen wrote:
> Vincent Lefevre <[email-masked]> writes:
> 
> >     (define-key map "\eOx" [kp-8])
> >     (define-key map "\eOy" [kp-9])
> >
> > Why nothing for [kp-equal]?
> 
> Yes, that seems odd.
> 
> Just to check -- does tack say that 9 on the keypad gives Ox and = on
> the keypad gives OX?

In xterm, tack says for the keypad keys 8, 9 and =:

^[Ox       (ka2)
^[Oy       (ka3)
^[OX       Unknown

So the meaning of ^[OX is unknown for tack and also ncurses.

I wonder whether this sequence is generated by xterm or some library.

On 2021-09-06 11:59:55 +0200, Andreas Schwab wrote:
> On Mär 28 2020, Vincent Lefevre wrote:
> 
> > Why nothing for [kp-equal]?
> 
> Probably because PC keyboards don't come with a '=' key on the keypad.

Indeed. The keypad of the PC keyboards seems to come from the
VT220 keypad block: ncurses has a file misc/terminfo.src with

# With the VT220 keypad block that uses the 1-9 keys as suggested in
# terminfo(5), the other keys can be handled with user-defined capabilities:
#
#   _______________________________________
#  | NumLock |    /    |    *    |    -    |
#  |         |   $Oo   |   $Oj   |   $OS   |
#  |_________|__kpDIV__|__kpMUL__|__kpSUB__|
#  |    7         8         9    |         |
#  |   $Ow   |   $Ox   |   $Oy   |    +    |
#  |_ka1__K1_|_________|_ka3__K3_|   $Ok   |
#  |    4    |    5    |    6    |  kpADD  |
#  |   $Ot   |   $Ou   |   $Ov   |         |
#  |_________|_kb2__K2_|_________|_________|
#  |    1    |    2    |    3    |         |
#  |   $Oq   |   $Or   |   $Os   |         |
#  |_kc1__K4_|_________|_kc3__K5_|  enter  |
#  |         0         |   .     |   $OM   |
#  |        $Op        |  $On    |         |
#  |___________________|_________|_kent_@8_|
#
xterm+keypad|xterm emulating VT100/VT220 numeric keypad,
        kp5=\EOE, kpADD=\EOk, kpCMA=\EOl, kpDIV=\EOo, kpDOT=\EOn,
        kpMUL=\EOj, kpSUB=\EOm, kpZRO=\EOp, use=vt220+keypad,

The keypad "=" key is an additional key on my Apple keyboard
(where the "+" key has a normal size instead of a double size,
allowing this additional key).

-- 
Vincent Lefèvre <[email-masked]> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)