Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: one more: default colors
- X-seq: zsh-workers 24026
- From: Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxx (Zsh hackers list)
- Subject: PATCH: one more: default colors
- Date: Sun, 28 Oct 2007 01:15:32 +0100
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
Just before I go to bed...
Index: configure.ac
===================================================================
RCS file: /cvsroot/zsh/zsh/configure.ac,v
retrieving revision 1.74
diff -u -r1.74 configure.ac
--- configure.ac 26 Oct 2007 21:59:56 -0000 1.74
+++ configure.ac 28 Oct 2007 00:15:16 -0000
@@ -1134,7 +1134,7 @@
brk sbrk \
pathconf sysconf \
tgetent tigetflag tigetnum tigetstr setupterm initscr \
- setcchar waddwstr wget_wch \
+ setcchar waddwstr wget_wch use_default_colors \
pcre_compile pcre_study pcre_exec \
nl_langinfo \
erand48 open_memstream \
Index: Doc/Zsh/mod_curses.yo
===================================================================
RCS file: /cvsroot/zsh/zsh/Doc/Zsh/mod_curses.yo,v
retrieving revision 1.14
diff -u -r1.14 mod_curses.yo
--- Doc/Zsh/mod_curses.yo 27 Oct 2007 23:53:16 -0000 1.14
+++ Doc/Zsh/mod_curses.yo 28 Oct 2007 00:15:18 -0000
@@ -83,9 +83,14 @@
given on the line may be prepended by a tt(+) to set or a tt(-) to
unset that attribute; tt(+) is assumed if absent. The attributes
supported are tt(blink), tt(bold), tt(dim), tt(reverse), tt(standout),
-and tt(underline). Each var(fg_col)tt(/)var(bg_col) (to be read as
+and tt(underline).
+
+Each var(fg_col)tt(/)var(bg_col) attribute (to be read as
`var(fg_col) on var(bg_col)') sets the foreground and background color
-for character output.
+for character output. The color tt(default) is sometimes available
+(in particular if the library is ncurses), specifying the foreground
+or background color with which the terminal started. The color pair
+tt(default/default) is always available.
tt(scroll) can be used with tt(on) or tt(off) to enabled or disable
scrolling of a window when the cursor would otherwise move below the
Index: Src/Modules/curses.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Modules/curses.c,v
retrieving revision 1.26
diff -u -r1.26 curses.c
--- Src/Modules/curses.c 27 Oct 2007 23:43:26 -0000 1.26
+++ Src/Modules/curses.c 28 Oct 2007 00:15:18 -0000
@@ -121,6 +121,9 @@
{"magenta", COLOR_MAGENTA},
{"cyan", COLOR_CYAN},
{"white", COLOR_WHITE},
+#ifdef HAVE_USE_DEFAULT_COLORS
+ {"default", -1},
+#endif
{NULL, 0}
};
@@ -337,6 +340,8 @@
w->flags = ZCWF_PERMANENT;
zinsertlinknode(zcurses_windows, lastnode(zcurses_windows), (void *)w);
if (start_color() != ERR) {
+ Colorpairnode cpn;
+
if(!zc_color_phase)
zc_color_phase = 1;
zcurses_colorpairs = newhashtable(8, "zc_colorpairs", NULL);
@@ -354,6 +359,16 @@
zcurses_colorpairs->freenode = freecolorpairnode;
zcurses_colorpairs->printnode = NULL;
+#ifdef HAVE_USE_DEFAULT_COLORS
+ use_default_colors();
+#endif
+ /* Initialise the default color pair, always 0 */
+ cpn = (Colorpairnode)zalloc(sizeof(struct colorpairnode));
+ if (cpn) {
+ cpn->colorpair = 0;
+ addhashnode(zcurses_colorpairs,
+ ztrdup("default/default"), (void *)cpn);
+ }
}
/*
* We use cbreak mode because we don't want line buffering
--
Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/
Messages sorted by:
Reverse Date,
Date,
Thread,
Author