[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
keyname
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
keyname(KEY_F1)
will return the string
"KEY_F(1)"
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
lf1=
lf2=
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
future.
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?
Thanks,
Willett Kempton
Visible Software and
University of Delaware