X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/e0f712ba55fa0d073f6ab93606e428f61fc7caf2..2afd5e90eb946a0e70547e56a4c705d7d0d4cb7f:/src/term.c diff --git a/src/term.c b/src/term.c index c2bac22d60..3add820421 100644 --- a/src/term.c +++ b/src/term.c @@ -1,5 +1,5 @@ /* Terminal control module for terminals described by TERMCAP - Copyright (C) 1985, 86, 87, 93, 94, 95, 98, 2000, 2001 + Copyright (C) 1985, 86, 87, 93, 94, 95, 98, 2000, 2001, 2002 Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -374,7 +374,7 @@ int max_frame_width; int max_frame_height; -int costs_set = 0; /* Nonzero if costs have been calculated. */ +static int costs_set; /* Nonzero if costs have been calculated. */ int insert_mode; /* Nonzero when in insert mode. */ int standout_mode; /* Nonzero when in standout mode. */ @@ -810,7 +810,8 @@ encode_terminal_code (src, dst, src_len, dst_len, consumed) struct glyph *src_start = src, *src_end = src + src_len; unsigned char *dst_start = dst, *dst_end = dst + dst_len; register GLYPH g; - unsigned char workbuf[MAX_MULTIBYTE_LENGTH], *buf; + unsigned char workbuf[MAX_MULTIBYTE_LENGTH]; + const unsigned char *buf; int len; register int tlen = GLYPH_TABLE_LENGTH; register Lisp_Object *tbase = GLYPH_TABLE_BASE; @@ -1987,6 +1988,32 @@ turn_off_face (f, face_id) } +/* Return non-zero if the terminal on frame F supports all of the + capabilities in CAPS simultaneously, with foreground and background + colors FG and BG. */ + +int +tty_capable_p (f, caps, fg, bg) + struct frame *f; + unsigned caps; + unsigned long fg, bg; +{ +#define TTY_CAPABLE_P_TRY(cap, TS, NC_bit) \ + if ((caps & (cap)) && (!(TS) || !MAY_USE_WITH_COLORS_P(NC_bit))) \ + return 0; + + TTY_CAPABLE_P_TRY (TTY_CAP_INVERSE, TS_standout_mode, NC_REVERSE); + TTY_CAPABLE_P_TRY (TTY_CAP_UNDERLINE, TS_enter_underline_mode, NC_UNDERLINE); + TTY_CAPABLE_P_TRY (TTY_CAP_BOLD, TS_enter_bold_mode, NC_BOLD); + TTY_CAPABLE_P_TRY (TTY_CAP_DIM, TS_enter_dim_mode, NC_DIM); + TTY_CAPABLE_P_TRY (TTY_CAP_BLINK, TS_enter_blink_mode, NC_BLINK); + TTY_CAPABLE_P_TRY (TTY_CAP_ALT_CHARSET, TS_enter_alt_charset_mode, NC_ALT_CHARSET); + + /* We can do it! */ + return 1; +} + + /* Return non-zero if the terminal is capable to display colors. */ DEFUN ("tty-display-color-p", Ftty_display_color_p, Stty_display_color_p,