aboutsummaryrefslogtreecommitdiffstats
path: root/src/term.c
diff options
context:
space:
mode:
authorGerd Moellmann2000-04-01 13:33:12 +0000
committerGerd Moellmann2000-04-01 13:33:12 +0000
commit4e6ba4a490eed7a9834cea33b13a76d892698c97 (patch)
tree0adcf99a144c3f316772409eb7419df9ede5262b /src/term.c
parent6fc556fdb41c112247d113d46cc215e73c9e2b3c (diff)
downloademacs-4e6ba4a490eed7a9834cea33b13a76d892698c97.tar.gz
emacs-4e6ba4a490eed7a9834cea33b13a76d892698c97.zip
(TN_no_color_video): New variable.
(term_init): Intitialize TN_no_color_video. (enum no_color_bit): New enumeration. (MAY_USE_WITH_COLORS_P): New macro. (turn_on_face): Use it to determine if attributes may be used combined with colors.
Diffstat (limited to 'src/term.c')
-rw-r--r--src/term.c61
1 files changed, 52 insertions, 9 deletions
diff --git a/src/term.c b/src/term.c
index ae829071682..5ee942895fb 100644
--- a/src/term.c
+++ b/src/term.c
@@ -268,6 +268,27 @@ char *TS_cursor_invisible; /* "vi" */
268char *TS_set_window; /* "wi" (4 params, start and end of window, 268char *TS_set_window; /* "wi" (4 params, start and end of window,
269 each as vpos and hpos) */ 269 each as vpos and hpos) */
270 270
271/* Value of the "NC" (no_color_video) capability, or 0 if not
272 present. */
273
274static int TN_no_color_video;
275
276/* Meaning of bits in no_color_video. Each bit set means that the
277 corresponding attribute cannot be combined with colors. */
278
279enum no_color_bit
280{
281 NC_STANDOUT = 1 << 0,
282 NC_UNDERLINE = 1 << 1,
283 NC_REVERSE = 1 << 2,
284 NC_BLINK = 1 << 3,
285 NC_DIM = 1 << 4,
286 NC_BOLD = 1 << 5,
287 NC_INVIS = 1 << 6,
288 NC_PROTECT = 1 << 7,
289 NC_ALT_CHARSET = 1 << 8
290};
291
271/* "md" -- turn on bold (extra bright mode). */ 292/* "md" -- turn on bold (extra bright mode). */
272 293
273char *TS_enter_bold_mode; 294char *TS_enter_bold_mode;
@@ -1934,6 +1955,15 @@ estimate_mode_line_height (f, face_id)
1934 Faces 1955 Faces
1935 ***********************************************************************/ 1956 ***********************************************************************/
1936 1957
1958/* Value is non-zero if attribute ATTR may be used. ATTR should be
1959 one of the enumerators from enum no_color_bit, or a bit set built
1960 from them. Some display attributes may not be used together with
1961 color; the termcap capability `NC' specifies which ones. */
1962
1963#define MAY_USE_WITH_COLORS_P(ATTR) \
1964 (TN_max_colors > 0 \
1965 ? (TN_no_color_video & (ATTR)) == 0 \
1966 : 1)
1937 1967
1938/* Turn appearances of face FACE_ID on tty frame F on. */ 1968/* Turn appearances of face FACE_ID on tty frame F on. */
1939 1969
@@ -1947,26 +1977,34 @@ turn_on_face (f, face_id)
1947 xassert (face != NULL); 1977 xassert (face != NULL);
1948 1978
1949 if (face->tty_bold_p) 1979 if (face->tty_bold_p)
1950 OUTPUT1_IF (TS_enter_bold_mode); 1980 {
1981 if (MAY_USE_WITH_COLORS_P (NC_BOLD))
1982 OUTPUT1_IF (TS_enter_bold_mode);
1983 }
1951 else if (face->tty_dim_p) 1984 else if (face->tty_dim_p)
1952 OUTPUT1_IF (TS_enter_dim_mode); 1985 if (MAY_USE_WITH_COLORS_P (NC_DIM))
1986 OUTPUT1_IF (TS_enter_dim_mode);
1953 1987
1954 /* Alternate charset and blinking not yet used. */ 1988 /* Alternate charset and blinking not yet used. */
1955 if (face->tty_alt_charset_p) 1989 if (face->tty_alt_charset_p
1990 && MAY_USE_WITH_COLORS_P (NC_ALT_CHARSET))
1956 OUTPUT1_IF (TS_enter_alt_charset_mode); 1991 OUTPUT1_IF (TS_enter_alt_charset_mode);
1957 1992
1958 if (face->tty_blinking_p) 1993 if (face->tty_blinking_p
1994 && MAY_USE_WITH_COLORS_P (NC_BLINK))
1959 OUTPUT1_IF (TS_enter_blink_mode); 1995 OUTPUT1_IF (TS_enter_blink_mode);
1960 1996
1961 if (face->tty_underline_p 1997 if (face->tty_underline_p
1962 /* Don't underline if that's difficult. */ 1998 /* Don't underline if that's difficult. */
1963 && TN_magic_cookie_glitch_ul <= 0) 1999 && TN_magic_cookie_glitch_ul <= 0
2000 && MAY_USE_WITH_COLORS_P (NC_UNDERLINE))
1964 OUTPUT1_IF (TS_enter_underline_mode); 2001 OUTPUT1_IF (TS_enter_underline_mode);
1965 2002
1966 if (face->tty_reverse_p 2003 if (MAY_USE_WITH_COLORS_P (NC_REVERSE))
1967 || face->foreground == FACE_TTY_DEFAULT_BG_COLOR 2004 if (face->tty_reverse_p
1968 || face->background == FACE_TTY_DEFAULT_FG_COLOR) 2005 || face->foreground == FACE_TTY_DEFAULT_BG_COLOR
1969 OUTPUT1_IF (TS_enter_reverse_mode); 2006 || face->background == FACE_TTY_DEFAULT_FG_COLOR)
2007 OUTPUT1_IF (TS_enter_reverse_mode);
1970 2008
1971 if (TN_max_colors > 0) 2009 if (TN_max_colors > 0)
1972 { 2010 {
@@ -2237,8 +2275,13 @@ to do `unset TERMCAP' (C-shell: `unsetenv TERMCAP') as well.",
2237 TS_set_foreground = tgetstr ("Sf", address); 2275 TS_set_foreground = tgetstr ("Sf", address);
2238 TS_set_background = tgetstr ("Sb", address); 2276 TS_set_background = tgetstr ("Sb", address);
2239 } 2277 }
2278
2240 TN_max_colors = tgetnum ("Co"); 2279 TN_max_colors = tgetnum ("Co");
2241 TN_max_pairs = tgetnum ("pa"); 2280 TN_max_pairs = tgetnum ("pa");
2281
2282 TN_no_color_video = tgetnum ("NC");
2283 if (TN_no_color_video == -1)
2284 TN_no_color_video = 0;
2242 } 2285 }
2243 2286
2244 MagicWrap = tgetflag ("xn"); 2287 MagicWrap = tgetflag ("xn");