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

Re: PATCH: zcurses stuff

Clint Adams wrote:
> On Tue, Oct 23, 2007 at 09:45:55PM +0100, Peter Stephenson wrote:
> > 2. I think I prefer "char" and "string" to "c" and "s", which are
> >    the names of the subcommands internally anyway.
> I'm still wondering if we should handle both char and string with
> a single subcommand.

Yes, that occurred to me too; we could call it "text".  I'm not sure if
we then need to handle single characters differently from strings.  If
we do, we need to be careful to see if it's a multibyte character first.

> We should expose some kind of interface for the caller to determine
> which colo[u]rs (if any) and attributes (when/if we start supporting
> optional ones) are available before trying to use them then.

We probably need other forms of querying, too.  It would be sensible to
provide a list of windows.  These could be special arrays,
zcurses_colors, zcurses_attrs, zcurses_windows?  We've traditionally had
a -l option for listing, but that doesn't seem to make sense here since
this is a purely programmatic interface.

While I'm here, here's the patch to make things work with just curses.h
and not ncurses.h.  The .mdd file already tests for the existence of
curses.h, so (supposedly) all we have to worry about is whether some
ancient versions of curses don't support even all the narrow character

Index: configure.ac
RCS file: /cvsroot/zsh/zsh/configure.ac,v
retrieving revision 1.72
diff -u -r1.72 configure.ac
--- configure.ac	18 Oct 2007 08:29:33 -0000	1.72
+++ configure.ac	24 Oct 2007 08:42:37 -0000
@@ -557,7 +557,7 @@
 		 unistd.h sys/capability.h \
 		 utmp.h utmpx.h sys/types.h pwd.h grp.h poll.h sys/mman.h \
 		 netinet/in_systm.h pcre.h langinfo.h wchar.h stddef.h \
-		 sys/stropts.h iconv.h)
+		 sys/stropts.h iconv.h ncurses.h)
 if test x$dynamic = xyes; then
Index: Src/Modules/curses.c
RCS file: /cvsroot/zsh/zsh/Src/Modules/curses.c,v
retrieving revision 1.19
diff -u -r1.19 curses.c
--- Src/Modules/curses.c	23 Oct 2007 21:16:03 -0000	1.19
+++ Src/Modules/curses.c	24 Oct 2007 08:42:41 -0000
@@ -29,7 +29,17 @@
-#include <ncurses.h>
+#include "curses.mdh"
+#include "curses.pro"
+# include <ncurses.h>
+# ifdef HAVE_CURSES_H
+#  include <curses.h>
+# endif
@@ -41,9 +51,6 @@
 #include <stdio.h>
-#include "curses.mdh"
-#include "curses.pro"
 typedef struct zc_win {
     WINDOW *win;
     char *name;

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