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

Re: PATCH: zcurses stuff



On Tue, Oct 23, 2007 at 09:45:55PM +0100, Peter Stephenson wrote:
> Other things I've thought about, but not done:
> 1. I think I prefer "end" to "endwin".  As I said, curses naming
>    is horrible and "endwin" to me suggests it applies to a single
>    window (indeed, what else could it logically mean?)
> 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.

> 3. I'm not sure we actually need both "attr" and "color"; we
>    can easily discriminate between types and as far as the user is
>    concerned it's natural to set them in a single command,
>      zcurses attr +bold red/black
>    Also, I think we could assume the "+" if not present; other
>    bits of the shell do this.

Sounds fine to me.

> 4. I think we can be more verbose with errors in places, for
>    example if colo[u]rs or attributes aren't found.  The fact that
>    it messes up the screen is neither here nor there if the result
>    didn't work anyway.

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.

Index: Doc/Zsh/mod_curses.yo
===================================================================
RCS file: /cvsroot/zsh/zsh/Doc/Zsh/mod_curses.yo,v
retrieving revision 1.7
diff -u -r1.7 mod_curses.yo
--- Doc/Zsh/mod_curses.yo	21 Oct 2007 19:53:44 -0000	1.7
+++ Doc/Zsh/mod_curses.yo	23 Oct 2007 21:03:06 -0000
@@ -7,18 +7,18 @@
 findex(zcurses)
 cindex(windows, curses)
 xitem(tt(zcurses) tt(init))
-xitem(tt(zcurses) tt(endwin))
+xitem(tt(zcurses) tt(end))
 xitem(tt(zcurses) tt(addwin) var(targetwin) var(nlines) var(ncols) var(begin_y) var(begin_x) )
 xitem(tt(zcurses) tt(delwin) var(targetwin) )
 xitem(tt(zcurses) tt(refresh) [ var(targetwin) ] )
 xitem(tt(zcurses) tt(move) var(targetwin) var(new_y) var(new_x) )
-xitem(tt(zcurses) tt(c) var(targetwin) var(character) )
-xitem(tt(zcurses) tt(s) var(targetwin) var(string) )
+xitem(tt(zcurses) tt(char) var(targetwin) var(character) )
+xitem(tt(zcurses) tt(string) var(targetwin) var(string) )
 xitem(tt(zcurses) tt(border) var(targetwin) var(border) )(
 item(tt(zcurses) tt(addwin) var(targetwin) var({+/-}attribute) [var({+/-}attribute)] [...])(
 Manipulate curses windows.  All uses of this command should be
 bracketed by `tt(zcurses init)' to initialise use of curses, and
-`tt(zcurses endwin)' to end it; omitting `tt(zcurses endwin)' can cause
+`tt(zcurses end)' to end it; omitting `tt(zcurses end)' can cause
 the terminal to be in an unwanted state.
 
 With tt(addwin), create a window with var(nlines) lines and var(ncols) columns.
@@ -30,13 +30,13 @@
 
 The tt(refresh) command will refresh window var(targetwin); this is necessary to
 make any pending changes (such as characters you have prepared for output
-with tt(c)) visible on the screen.  If no argument is given,
+with tt(char)) visible on the screen.  If no argument is given,
 all windows are refreshed; this is necessary after deleting a window.
 
 tt(move) moves the cursor position in var(targetwin) to new coordinates
 var(new_y) and var(new_x).
 
-Outputting characters and strings are achieved by tt(c) and tt(s)
+Outputting characters and strings are achieved by tt(char) and tt(string)
 respectively.
 
 To draw a border around window var(targetwin), use tt(border).
Index: Src/Modules/curses.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Modules/curses.c,v
retrieving revision 1.18
diff -u -r1.18 curses.c
--- Src/Modules/curses.c	23 Oct 2007 20:55:42 -0000	1.18
+++ Src/Modules/curses.c	23 Oct 2007 21:03:07 -0000
@@ -612,10 +612,10 @@
 	{"delwin", zccmd_delwin, 1, 1},
 	{"refresh", zccmd_refresh, 0, 1},
 	{"move", zccmd_move, 3, 3},
-	{"c", zccmd_char, 2, 2},
-	{"s", zccmd_string, 2, 2},
+	{"char", zccmd_char, 2, 2},
+	{"string", zccmd_string, 2, 2},
 	{"border", zccmd_border, 1, 1},
-	{"endwin", zccmd_endwin, 0, 0},
+	{"end", zccmd_endwin, 0, 0},
 	{"attr", zccmd_attr, 2, -1},
 	{"color", zccmd_color, 2, 2},
 	{NULL, (zccmd_t)0, 0, 0}



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