bug-ncurses
[Top][All Lists]
Advanced

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

Re: Forms and catching keys


From: Thomas Dickey
Subject: Re: Forms and catching keys
Date: Mon, 25 Oct 2010 04:19:13 -0400 (EDT)

On Mon, 25 Oct 2010, John P. Hartmann wrote:

On 24 October 2010 19:22, Dulek <address@hidden> wrote:
Another problem is with catching Ctrl+Home and Ctrl+End keys. Keycodes for
Home and for Ctrl+Home are the same. I have no idea how to make a workaround
for this issue.

ncurses define no key_x macro for ctl+anything, so you're on your own.
On my combination of xorg, xterm, and ncurses, ctl-home sends 01022
(x'212); ctl-end sends 01015 (x'20d').  You'll have to discover
whatever escape sequence is generated by the hardware and set up your
a termcap mapping to suit your taste.  Highly non-portable, of course.

The 01022, etc., are computed at runtime because the control/whatever are
represented as an extended key in the terminal description. Several ncurses entries provide extended key descriptions for the control, shift,
modifiers of xterm, rxvt as well as various other terminals that copy the
key-bindings from one of those.

The naming convention is documented in terminfo.src, e.g.,

# This fragment describes as much of XFree86 xterm's "pc-style" function # keys as will fit into terminfo's 60 function keys. # From ctlseqs.ms: # Code Modifiers # --------------------------------- # 2 Shift # 3 Alt # 4 Shift + Alt # 5 Control # 6 Shift + Control # 7 Alt + Control # 8 Shift + Alt + Control # --------------------------------- # The meta key may also be used as a modifier in this scheme, adding another # bit to the parameter. xterm+pcfkeys|fragment for PC-style fkeys,
        use=xterm+app, use=xterm+pcf2, use=xterm+pcc2,
        use=xterm+pce2,

An application can use key_defined() to obtain the actual code used for
a given extended key.

--
Thomas E. Dickey
http://invisible-island.net
ftp://invisible-island.net



reply via email to

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