[Top][All Lists]

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


From: willett
Subject: keyname
Date: Mon, 5 Sep 2005 03:46:58 -0400

I'm enjoying using ncurses, which work great. Question/bug report follows.

Am I understanding function keyname correctly?

It returns the internal variable name as a string. That is, a program calling

will return the string

But to be useful for a program presenting key prompts to a user,
the programmer would want this function to return a string like "F1".

Related issue, keyname does not seem to use the entries in terminfo
for key labels, eg
etc. (Or, l1=, l2= in termcap). These are described in "Termcap & terminfo" book as, e.g., "lf1= The label on the first function key, if not F1."

I've written a routine to clean up the returned key labels, but I was
wondering if there's another ncurses function I'm missing, or if
this is the intended behavior, or I this might get changed in the

Incidentally, my routine:
  1. Strips off the initial "KEY_"
  2. Strip out "(" and ")"
3. If its in the range ([KEY_SBEG .. KEY_SUNDO] (except for [KEY_SELECT],
    then trim the S and put in place "Shift-".

Thus we get, for example, "F1" rather than "KEY_F(1)", and
"Shift-UNDO" rather than "KEY_SUNDO".
Do you think it would be desirable for keyname to behave more
like this?


Willett Kempton
Visible Software and
University of Delaware

reply via email to

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