diff options
author | Peter Stephenson <pws@users.sourceforge.net> | 2007-10-28 00:21:54 +0000 |
---|---|---|
committer | Peter Stephenson <pws@users.sourceforge.net> | 2007-10-28 00:21:54 +0000 |
commit | 52d3fdc80eec12f43f005a93e902dbc64e7591fc (patch) | |
tree | f92b0f5bae2a35d14047cb4c3e11e046de703df1 | |
parent | 1c6416596ab0baa03302f09a9ae67377756637bf (diff) | |
download | zsh-52d3fdc80eec12f43f005a93e902dbc64e7591fc.tar.gz zsh-52d3fdc80eec12f43f005a93e902dbc64e7591fc.tar.xz zsh-52d3fdc80eec12f43f005a93e902dbc64e7591fc.zip |
24026: default colors in zcurses
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | Doc/Zsh/mod_curses.yo | 9 | ||||
-rw-r--r-- | Src/Modules/curses.c | 15 | ||||
-rw-r--r-- | configure.ac | 2 |
4 files changed, 27 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog index dbdafa24d..684ce15f6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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(). diff --git a/Doc/Zsh/mod_curses.yo b/Doc/Zsh/mod_curses.yo index 4198038e1..9cd521d19 100644 --- a/Doc/Zsh/mod_curses.yo +++ b/Doc/Zsh/mod_curses.yo @@ -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 diff --git a/Src/Modules/curses.c b/Src/Modules/curses.c index 919049ab0..e82576133 100644 --- a/Src/Modules/curses.c +++ b/Src/Modules/curses.c @@ -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 diff --git a/configure.ac b/configure.ac index ebd339630..85eb2141f 100644 --- a/configure.ac +++ b/configure.ac @@ -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 \ |