summaryrefslogtreecommitdiff
path: root/src/term.c
diff options
context:
space:
mode:
authorRami Ylimäki <rami.ylimaki@vincit.fi>2018-02-10 13:31:22 +0200
committerEli Zaretskii <eliz@gnu.org>2018-02-10 13:31:22 +0200
commit7f6153d9563cfe7753083996f59eacc9f4c694df (patch)
treeae6a5f987eb686e318fe463a953a406843455c43 /src/term.c
parent6dcfdb1d4b7d8936c6d549ffd3206f50ed61e9cf (diff)
downloademacs-7f6153d9563cfe7753083996f59eacc9f4c694df.tar.gz
Support standard Terminfo direct mode terminals
Latest Terminfo introduces terminal definitions that support direct color mode. The "Co"/"colors" capability is set to 0x1000000 on these terminals and Emacs is already compatible with them. However, if used Terminfo library hasn't been compiled with 32-bit value support, "Co"/"colors" is truncated to 0x7fff. In this case direct color mode support can be detected from the "RGB" capability flag. There are some minor problems if the color count isn't corrected from 0x7fff. First eight standard colors defined in xterm-standard-colors are shown correctly. However, their RGB values match the terminal settings, not the RGB values defined in xterm-standard-colors. Bright versions of these colors are shown incorrectly. They are interpreted as pixels #000008 - #000015, which are very dark shades of blue. * src/term.c (init_tty): Force terminal color count to 0x1000000 if "RGB" capability is present. * src/tparam.h: Define prototype for tigetflag. (Bug#30308) * doc/misc/efaq.texi (Colors on a TTY): Add information about direct mode terminals supported by Terminfo.
Diffstat (limited to 'src/term.c')
-rw-r--r--src/term.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/term.c b/src/term.c
index b3707da70a2..64a2b7e5519 100644
--- a/src/term.c
+++ b/src/term.c
@@ -4144,10 +4144,10 @@ use the Bourne shell command 'TERM=...; export TERM' (C-shell:\n\
tty->TN_max_colors = tgetnum ("Co");
#ifdef TERMINFO
- /* Non-standard support for 24-bit colors. */
{
const char *fg = tigetstr ("setf24");
const char *bg = tigetstr ("setb24");
+ /* Non-standard support for 24-bit colors. */
if (fg && bg
&& fg != (char *) (intptr_t) -1
&& bg != (char *) (intptr_t) -1)
@@ -4156,6 +4156,14 @@ use the Bourne shell command 'TERM=...; export TERM' (C-shell:\n\
tty->TS_set_background = bg;
tty->TN_max_colors = 16777216;
}
+ /* Standard support for 24-bit colors. */
+ else if (tigetflag ("RGB") > 0)
+ {
+ /* If the used Terminfo library supports only 16-bit
+ signed values, tgetnum("Co") and tigetnum("colors")
+ could return 32767. */
+ tty->TN_max_colors = 16777216;
+ }
}
#endif