emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master f30f531: Support Tc terminfo flag for 24-bit color support in ter


From: Lars Ingebrigtsen
Subject: master f30f531: Support Tc terminfo flag for 24-bit color support in terminal
Date: Thu, 11 Nov 2021 01:15:58 -0500 (EST)

branch: master
commit f30f53115928fd65d066944d53d07742b0807670
Author: Tim Ruffing <crypto@timruffing.de>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    Support Tc terminfo flag for 24-bit color support in terminal
    
    * src/term.c (init_tty): Use the Tc flag (bug#44950).
    
    Copyright-paperwork-exempt: yes
---
 etc/NEWS   |  5 +++++
 src/term.c | 10 ++++++----
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index e324469..e0b1c35 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -46,6 +46,11 @@ time.
 
 * Changes in Emacs 29.1
 
+** Terminal Emacs
+
+---
+*** Emacs will now use 24-bit colors on terminal that support "Tc".
+
 ** Emoji
 
 +++
diff --git a/src/term.c b/src/term.c
index 6f0b827..d86ae12 100644
--- a/src/term.c
+++ b/src/term.c
@@ -4152,10 +4152,12 @@ use the Bourne shell command 'TERM=...; export TERM' 
(C-shell:\n\
               could return 32767.  */
            tty->TN_max_colors = 16777216;
          }
-       /* Fall back to xterm+direct (semicolon version) if requested
-          by the COLORTERM environment variable.  */
-       else if ((bg = getenv("COLORTERM")) != NULL
-                && strcasecmp(bg, "truecolor") == 0)
+       /* Fall back to xterm+direct (semicolon version) if Tc is set
+          (de-facto standard introduced by tmux) or if requested by
+          the COLORTERM environment variable.  */
+       else if (tigetflag("Tc")
+                || ((bg = getenv("COLORTERM")) != NULL
+                    && strcasecmp(bg, "truecolor") == 0))
          {
            tty->TS_set_foreground = 
"\033[%?%p1%{8}%<%t3%p1%d%e38;2;%p1%{65536}%/%d;%p1%{256}%/%{255}%&%d;%p1%{255}%&%d%;m";
            tty->TS_set_background = 
"\033[%?%p1%{8}%<%t4%p1%d%e48;2;%p1%{65536}%/%d;%p1%{256}%/%{255}%&%d;%p1%{255}%&%d%;m";



reply via email to

[Prev in Thread] Current Thread [Next in Thread]