zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <pws@csr.com>
To: zsh-workers@sunsite.dk (Zsh hackers list)
Subject: PATCH: $zcurses_keycodes
Date: Tue, 06 Nov 2007 14:03:04 +0000	[thread overview]
Message-ID: <28946.1194357784@csr.com> (raw)

$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


                 reply	other threads:[~2007-11-06 14:03 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=28946.1194357784@csr.com \
    --to=pws@csr.com \
    --cc=zsh-workers@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).