Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: $zcurses_keycodes



$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@xxxxxxx>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070



Messages sorted by: Reverse Date, Date, Thread, Author