mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-09-29 06:51:03 +02:00
24026: default colors in zcurses
This commit is contained in:
parent
1c6416596a
commit
52d3fdc80e
4 changed files with 27 additions and 3 deletions
|
@ -1,5 +1,9 @@
|
||||||
2007-10-28 Peter Stephenson <p.w.stephenson@ntlworld.com>
|
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
|
* unposted: Doc/Zsh/mod_curses.yo: Oops, misdescribed the
|
||||||
effect of getmaxyx().
|
effect of getmaxyx().
|
||||||
|
|
||||||
|
|
|
@ -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
|
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
|
unset that attribute; tt(+) is assumed if absent. The attributes
|
||||||
supported are tt(blink), tt(bold), tt(dim), tt(reverse), tt(standout),
|
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
|
`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
|
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
|
scrolling of a window when the cursor would otherwise move below the
|
||||||
|
|
|
@ -121,6 +121,9 @@ static const struct zcurses_namenumberpair zcurses_colors[] = {
|
||||||
{"magenta", COLOR_MAGENTA},
|
{"magenta", COLOR_MAGENTA},
|
||||||
{"cyan", COLOR_CYAN},
|
{"cyan", COLOR_CYAN},
|
||||||
{"white", COLOR_WHITE},
|
{"white", COLOR_WHITE},
|
||||||
|
#ifdef HAVE_USE_DEFAULT_COLORS
|
||||||
|
{"default", -1},
|
||||||
|
#endif
|
||||||
{NULL, 0}
|
{NULL, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -337,6 +340,8 @@ zccmd_init(const char *nam, char **args)
|
||||||
w->flags = ZCWF_PERMANENT;
|
w->flags = ZCWF_PERMANENT;
|
||||||
zinsertlinknode(zcurses_windows, lastnode(zcurses_windows), (void *)w);
|
zinsertlinknode(zcurses_windows, lastnode(zcurses_windows), (void *)w);
|
||||||
if (start_color() != ERR) {
|
if (start_color() != ERR) {
|
||||||
|
Colorpairnode cpn;
|
||||||
|
|
||||||
if(!zc_color_phase)
|
if(!zc_color_phase)
|
||||||
zc_color_phase = 1;
|
zc_color_phase = 1;
|
||||||
zcurses_colorpairs = newhashtable(8, "zc_colorpairs", NULL);
|
zcurses_colorpairs = newhashtable(8, "zc_colorpairs", NULL);
|
||||||
|
@ -354,6 +359,16 @@ zccmd_init(const char *nam, char **args)
|
||||||
zcurses_colorpairs->freenode = freecolorpairnode;
|
zcurses_colorpairs->freenode = freecolorpairnode;
|
||||||
zcurses_colorpairs->printnode = NULL;
|
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
|
* We use cbreak mode because we don't want line buffering
|
||||||
|
|
|
@ -1134,7 +1134,7 @@ AC_CHECK_FUNCS(strftime strptime mktime timelocal \
|
||||||
brk sbrk \
|
brk sbrk \
|
||||||
pathconf sysconf \
|
pathconf sysconf \
|
||||||
tgetent tigetflag tigetnum tigetstr setupterm initscr \
|
tgetent tigetflag tigetnum tigetstr setupterm initscr \
|
||||||
setcchar waddwstr wget_wch \
|
setcchar waddwstr wget_wch use_default_colors \
|
||||||
pcre_compile pcre_study pcre_exec \
|
pcre_compile pcre_study pcre_exec \
|
||||||
nl_langinfo \
|
nl_langinfo \
|
||||||
erand48 open_memstream \
|
erand48 open_memstream \
|
||||||
|
|
Loading…
Reference in a new issue