bug-ncurses
[Top][All Lists]
Advanced

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

Re: I don't understand ncurses dealing with control-ARROW


From: Thomas Dickey
Subject: Re: I don't understand ncurses dealing with control-ARROW
Date: Tue, 22 Dec 2015 15:11:57 -0500
User-agent: Mutt/1.5.21 (2010-09-15)

On Mon, Dec 21, 2015 at 12:24:04PM +0100, Steffen Nurpmeso wrote:
> Hello and good morning,
> 
> Thomas Dickey <address@hidden> wrote:
>  |On Thu, Dec 17, 2015 at 10:52:38PM +0100, Steffen Nurpmeso wrote:
> 
>  |> I'm currently rewriting some code that deals with termcap (being
>  |> out of the question before) and don't actually understand how to
>  |> get at the control-ARROW etc. modifiers.
> 
>  |> nsterm, yet TERM=screen.xterm-256color (over ssh) and infocmp(1)
>  |> doesn't output anything for kLFT5.  How do you do that?  ..Is this
>  |> interpolated given that kLFT=\E[1;2D for both?  (..Likely..)
>  |
>  |no, it's not interpolated, but all explicit.  You have to add the "-x"
>  |option of infocmp to see the extended/user-defined capabilities.
> 
> Oh.  Indeed, that shows them.  Fyi please note that i would not
> have expected anything neither under user-defined nor under "treat
> unknown as user-defined" (what tic says for -x).  I.e., isn't that
> a regular entry?  And: which standard do i have to read to be able
> to be enabled to tell so by myself?  (Maybe rethorical question :)

tic's usage message says

  -x         treat unknown capabilities as user-defined
 
and I used the same wording for infocmp's usage message:

  -x    treat unknown capabilities as user-defined

man infocmp says a little more

       -x   print information for user-defined capabilities.  These are exten‐
            sions to the terminfo repertoire which can be loaded using the  -x
            option of tic.

and a little more in tic:

       -x   Treat  unknown capabilities as user-defined.  That is, if you sup‐
            ply a capability name which tic does not recognize, it will  infer
            its  type  (boolean, number or string) from the syntax and make an
            extended table entry for that.   User-defined  capability  strings
            whose name begins with ``k'' are treated as function keys.

I give some background here (in the subsection on "extensible terminfo":

http://invisible-island.net/ncurses/tctest.html#history_myself

and some technical details here:

http://invisible-island.net/ncurses/terminfo.src.html#toc-_N_C_U_R_S_E_S__U_S_E_R-_D_E_F_I_N_A_B_L_E__C_A_P_A_B_I_L_I_T_I_E_S

as well as (i.e., "man 5 term"):

http://invisible-island.net/ncurses/man/term.5.html

>  |Comparing the output of these (nsterm with/without "-x"):
>  ...
> 
>  |> My question is why this is kLFT5 given that Caps.keys says the
>  |> capname will be kclft?  Also, for kclft there is a %k termcap
>  |> mapping, but i couldn't find any hint on such a thing for kLFT5.
>  |
>  |oh... I'd have to say that Caps.keys was experimental
>  | 
>  |20010804                                                             \
>  |           
>  |        + add Caps.keys example for experimental extended function keys
>  |   (adapted from a patch by Ilya Zakharevich).
> 
> Ah.
> 
>  |but that I did not take it into account when adding the xterm function
>  |keys because (besides not thinking about it), there are many more
>  |combinations of modifiers in xterm than the enumeration in Caps.keys
>  |would handle.
> 
> Hm.  Then again not that much more (enough for __me__!!!!!).  But
> of course you are right, you have to give a name to an entire
> combination and that will lead you to nowhere.

right.  And xterm's resources that apply to keyboards can be combined
in a lot of ways.  I document some of them as terminfo building-blocks

http://invisible-island.net/ncurses/terminfo.src.html#tic-xterm_pcfkeys

>  |Caps.keys is an example (like the other Caps.* files) which ncurses
>  |could be compiled with, but I don't recall anyone actually using it.
> 
> Oh.  Well.  My way lead me over termcap(5) and terminfo(5) over
> a remembered thread on the rxvt-unicode ML to several therein
> referenced pages, one of which lead to the file Caps.keys, another
> to your home page and the modifier table example for the delete
> character function -- i think it was?  dc?  (Odysseus' was more
> dangerous, but at least there were women along the way, hahaha..)
> 
>  |> For me the worst is that i cannot give end-users just any hint on
>  |> how to get at the actual name nor sequence, except by copy+pasting
>  |> a small C program that queries kLFT5++ and returns what is true as
>  |> opposed to what infocmp says for $TERM.  I'm thinking about
>  |> deliberately violating ncurses (?) by using tigetstr() in
>  |> conjunction with tgetent() when it is available.
>  |
>  |I recommend using tigetstr, since tgetstr (termcap) won't handle the
>  |longer names.
> 
> It would work.  Good to know.  I've added a note to the manual
> that "$ cat" should be used and explained what escape is and how
> to define a control character, and gave an example
> 
>   set termcap="%k=\033[D,%o=\033[C,%q=\033[A,%r=\033[B"

yes... "cat -v" (and control/V) are a good starting point.
 
> But if tigetstr() works even if i otherwise only use the old-style
> termcap approach then i think i will extend the code again and use
> it if available; since these are rather exotic functions the user
> will have to manually adjust in other environments, which i hope
> the manual will enable her to.
> 
> Thanks!  And ciao (and a merry Christmas, too),
> 
> --steffen

-- 
Thomas E. Dickey <address@hidden>
http://invisible-island.net
ftp://invisible-island.net

Attachment: signature.asc
Description: Digital signature


reply via email to

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