zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: $zcurses_keycodes
@ 2007-11-06 14:03 Peter Stephenson
  0 siblings, 0 replies; only message in thread
From: Peter Stephenson @ 2007-11-06 14:03 UTC (permalink / raw)
  To: Zsh hackers list

$zcurses_keycodes returns a list of the possible special keys that can
be returned by `zcurses input'.  (This was a heck of lot easier than
what I'm supposed to be doing.)

Index: Doc/Zsh/mod_curses.yo
===================================================================
RCS file: /cvsroot/zsh/zsh/Doc/Zsh/mod_curses.yo,v
retrieving revision 1.18
diff -u -r1.18 mod_curses.yo
--- Doc/Zsh/mod_curses.yo	30 Oct 2007 21:03:12 -0000	1.18
+++ Doc/Zsh/mod_curses.yo	6 Nov 2007 14:01:10 -0000
@@ -176,6 +176,13 @@
 Readonly array.  The colors supported by tt(zsh/curses); available
 as soon as the module is loaded.
 )
+vindex(zcurses_keycodes)
+item(tt(zcurses_keycodes))(
+Readonly array.  The values that may be returned in the second
+parameter supplied to `tt(zcurses input)' in the order in which they
+are defined internally by curses.  Not all function keys
+are listed, only tt(F0); curses reserves space for tt(F0) up to tt(F63).
+)
 vindex(zcurses_windows)
 item(tt(zcurses_windows))(
 Readonly array.  The current list of windows, i.e. all windows that
Index: Src/Modules/curses.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Modules/curses.c,v
retrieving revision 1.32
diff -u -r1.32 curses.c
--- Src/Modules/curses.c	30 Oct 2007 21:03:12 -0000	1.32
+++ Src/Modules/curses.c	6 Nov 2007 14:01:10 -0000
@@ -1210,6 +1210,16 @@
 
 
 static char **
+zcurses_keycodesgetfn(UNUSED(Param pm))
+{
+    return zcurses_pairs_to_array(keypad_names);
+}
+
+static const struct gsu_array zcurses_keycodes_gsu =
+{ zcurses_keycodesgetfn, arrsetfn, stdunsetfn };
+
+
+static char **
 zcurses_windowsgetfn(UNUSED(Param pm))
 {
     LinkNode node;
@@ -1254,6 +1264,8 @@
 		 &zcurses_colorsarr_gsu, NULL, NULL),
     SPECIALPMDEF("zcurses_attrs", PM_ARRAY|PM_READONLY,
 		 &zcurses_attrs_gsu, NULL, NULL),
+    SPECIALPMDEF("zcurses_keycodes", PM_ARRAY|PM_READONLY,
+		 &zcurses_keycodes_gsu, NULL, NULL),
     SPECIALPMDEF("zcurses_windows", PM_ARRAY|PM_READONLY,
 		 &zcurses_windows_gsu, NULL, NULL),
     SPECIALPMDEF("ZCURSES_COLORS", PM_INTEGER|PM_READONLY,


-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-11-06 14:03 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-11-06 14:03 PATCH: $zcurses_keycodes Peter Stephenson

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).