about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2007-11-06 14:14:16 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2007-11-06 14:14:16 +0000
commitea15ee886789a31160f5e87ae466adadbb1e5815 (patch)
treea42ff7338e1406ac0e0f2ed3ae500c801a6d17fb
parentb9f3fc7c81dfde1400ebec848a1356116d2e95aa (diff)
downloadzsh-ea15ee886789a31160f5e87ae466adadbb1e5815.tar.gz
zsh-ea15ee886789a31160f5e87ae466adadbb1e5815.tar.xz
zsh-ea15ee886789a31160f5e87ae466adadbb1e5815.zip
24069: add zcurses_keycodes
-rw-r--r--ChangeLog3
-rw-r--r--Doc/Zsh/mod_curses.yo7
-rw-r--r--Src/Modules/curses.c12
3 files changed, 22 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 2fd6cb9a2..cbe2ac8ce 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2007-11-06  Peter Stephenson  <pws@csr.com>
 
+	* 24069: Doc/Zsh/mod_curses.yo, Src/Modules/curses.c: add
+	$zcurses_keycodes.
+
 	* 24068: Src/builtin.c: attempt to make `printf "%g\n" -0'
 	output "-0", although this depends on the vagaries of the
 	library's strtod() (works on Solaris, doesn't on Fedora 7).
diff --git a/Doc/Zsh/mod_curses.yo b/Doc/Zsh/mod_curses.yo
index f83951de3..993584ea1 100644
--- a/Doc/Zsh/mod_curses.yo
+++ b/Doc/Zsh/mod_curses.yo
@@ -176,6 +176,13 @@ item(tt(zcurses_colors))(
 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
diff --git a/Src/Modules/curses.c b/Src/Modules/curses.c
index c9e4ec134..08fe0099b 100644
--- a/Src/Modules/curses.c
+++ b/Src/Modules/curses.c
@@ -1210,6 +1210,16 @@ static const struct gsu_array zcurses_attrs_gsu =
 
 
 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 @@ static struct paramdef partab[] = {
 		 &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,