diff options
author | 2000-03-10 01:35:01 +0000 | |
---|---|---|
committer | 2000-03-10 01:35:01 +0000 | |
commit | 4b107ee47ccf17c9f1ad6db8a59eb142776341c8 (patch) | |
tree | 20e23a45f7f7880a685cfd1261008320e43805bb /lib/libcurses/base/lib_color.c | |
parent | increased buffer size. (diff) | |
download | wireguard-openbsd-4b107ee47ccf17c9f1ad6db8a59eb142776341c8.tar.xz wireguard-openbsd-4b107ee47ccf17c9f1ad6db8a59eb142776341c8.zip |
Update to ncurses-5.0-20000304
Diffstat (limited to 'lib/libcurses/base/lib_color.c')
-rw-r--r-- | lib/libcurses/base/lib_color.c | 70 |
1 files changed, 42 insertions, 28 deletions
diff --git a/lib/libcurses/base/lib_color.c b/lib/libcurses/base/lib_color.c index f60847d43cd..e917647497b 100644 --- a/lib/libcurses/base/lib_color.c +++ b/lib/libcurses/base/lib_color.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_color.c,v 1.5 2000/01/02 22:06:51 millert Exp $ */ +/* $OpenBSD: lib_color.c,v 1.6 2000/03/10 01:35:02 millert Exp $ */ /**************************************************************************** - * Copyright (c) 1998-2000 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -43,11 +43,11 @@ #include <term.h> #include <tic.h> -MODULE_ID("$From: lib_color.c,v 1.42 2000/01/01 16:42:37 tom Exp $") +MODULE_ID("$From: lib_color.c,v 1.45 2000/02/27 00:20:31 tom Exp $") /* * These should be screen structure members. They need to be globals for - * hystorical reasons. So we assign them in start_color() and also in + * historical reasons. So we assign them in start_color() and also in * set_term()'s screen-switching logic. */ int COLOR_PAIRS = 0; @@ -91,13 +91,13 @@ static const color_t hls_palette[] = static int default_fg(void) { - return (SP->_default_fg >= 0) ? SP->_default_fg : COLOR_WHITE; + return (SP->_default_fg != C_MASK) ? SP->_default_fg : COLOR_WHITE; } static int default_bg(void) { - return (SP->_default_bg >= 0) ? SP->_default_bg : COLOR_BLACK; + return (SP->_default_bg != C_MASK) ? SP->_default_bg : COLOR_BLACK; } #else #define default_fg() COLOR_WHITE @@ -420,37 +420,51 @@ _nc_do_color(int pair, bool reverse, int (*outc) (int)) !SP->_default_color || #endif !set_original_colors()) { - set_foreground_color(default_fg(), outc); - set_background_color(default_bg(), outc); + fg = default_fg(); + bg = default_bg(); + } else { + fg = C_MASK; + bg = C_MASK; } } else { if (set_color_pair) { TPUTS_TRACE("set_color_pair"); tputs(tparm(set_color_pair, pair), 1, outc); + return; } else { pair_content(pair, &fg, &bg); - if (reverse) { - short xx = fg; - fg = bg; - bg = xx; +#ifdef NCURSES_EXT_FUNCS + if (SP->_default_color) { + if (fg == C_MASK) + fg = SP->_default_fg; + if (bg == C_MASK) + bg = SP->_default_bg; } +#endif + } + } - T(("setting colors: pair = %d, fg = %d, bg = %d", pair, fg, bg)); - - if (fg == C_MASK || bg == C_MASK) { - if (set_original_colors() != TRUE) { - if (fg == C_MASK) - set_foreground_color(default_fg(), outc); - if (bg == C_MASK) - set_background_color(default_bg(), outc); - } - } - if (fg != C_MASK) { - set_foreground_color(fg, outc); - } - if (bg != C_MASK) { - set_background_color(bg, outc); - } + if (fg == C_MASK || bg == C_MASK) { + if (set_original_colors() != TRUE) { + if (fg == C_MASK) + fg = default_fg(); + if (bg == C_MASK) + bg = default_bg(); } } + + if (reverse) { + short xx = fg; + fg = bg; + bg = xx; + } + + T(("setting colors: pair = %d, fg = %d, bg = %d", pair, fg, bg)); + + if (fg != C_MASK) { + set_foreground_color(fg, outc); + } + if (bg != C_MASK) { + set_background_color(bg, outc); + } } |