[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: translating numpad keys in linux terminal

From: Simon Clubley
Subject: Re: translating numpad keys in linux terminal
Date: Fri, 3 Apr 2015 13:35:06 +0000 (UTC)
User-agent: slrn/ (VMS/Multinet)

On 2015-04-02, Emanuel Berg <address@hidden> wrote:
> Simon Clubley
><address@hidden> writes:
>> ... tpu-edt.el ... when TERM is set to vt200, the
>> keypad keys other than PF1-PF4 still work when in
>> application keypad mode, so this might be enough for
>> you. ...
> What? :)

I promise you that explanation would make perfect sense to someone
with a DEC background who had actually used the physical terminals
the various emulators emulate (with various degrees of accuracy). :-)

> Please explain in more detail what to do step by step.

Other postings have covered most of this. However, a bit of background
on DEC terminals because I can see why you might be confused by what
I said.

On a DEC terminal, the top row of the keypad sends out escape sequences
when the keys on that row are pressed. The keys are known as PF1 (which
is the Num Lock position on a PC keyboard) through PF4 (the minus key).
PF1 is also known as the Gold key in the DEC world and you can see it
described as such in tpu-edt.el.

The rest of the keypad can operate in one of two modes, a numeric keypad
mode and an application keypad mode. You can switch the terminal between
these two modes by sending escape sequences to the terminal from a program.

In numeric mode, pressing (say) the 5 key, sends a 5. In application keypad
mode, pressing a key sends a specific and unique escape sequence.
Applications in the DEC world (such as editors) use this to determine the
user pressed a key on the keypad instead of on the main keyboard.

> If I set TERM to vt200 ('TERM=vt200 emacs -nw' in
> xterm), my colors are broken. Tho I am able to
> (require 'tpu-edt) that doesn't do anything to change
> the keys reported by `describe-key' what I can see.
> But yes, X and xterm should be enough because as said,
> xev do reports different keys when run from xterm.

As someone else mentioned, the different keycodes are required, but not
sufficient. When emacs is in character cell mode (emacs -nw) the only
thing it can see are the escape sequences coming from the terminal
emulator; it has no knowledge of what is going on at X11 level.

Either the terminal emulator already knows it needs to send these escape
sequences in response to a key press or it needs to be configured to do
so via some keycode to escape sequence mapping.


Simon Clubley, address@hidden
Microsoft: Bringing you 1980s technology to a 21st century world

reply via email to

[Prev in Thread] Current Thread [Next in Thread]