1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-09-25 05:31:19 +02:00

24026: default colors in zcurses

This commit is contained in:
Peter Stephenson 2007-10-28 00:21:54 +00:00
parent 1c6416596a
commit 52d3fdc80e
4 changed files with 27 additions and 3 deletions

View file

@ -1,5 +1,9 @@
2007-10-28 Peter Stephenson <p.w.stephenson@ntlworld.com>
* 24026: Doc/Zsh/mod_curses.yo, Src/Modules/curses.c:
handle default/default colorpair and handle color
default separately if use_default_colors() is available.
* unposted: Doc/Zsh/mod_curses.yo: Oops, misdescribed the
effect of getmaxyx().

View file

@ -83,9 +83,14 @@ color pair for any successive character output. Each var(attribute)
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

View file

@ -121,6 +121,9 @@ static const struct zcurses_namenumberpair zcurses_colors[] = {
{"magenta", COLOR_MAGENTA},
{"cyan", COLOR_CYAN},
{"white", COLOR_WHITE},
#ifdef HAVE_USE_DEFAULT_COLORS
{"default", -1},
#endif
{NULL, 0}
};
@ -337,6 +340,8 @@ zccmd_init(const char *nam, char **args)
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 @@ zccmd_init(const char *nam, char **args)
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

View file

@ -1134,7 +1134,7 @@ AC_CHECK_FUNCS(strftime strptime mktime timelocal \
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 \