bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#51297: 28.0.60; [PATCH] Update termcap/terminfo to indicate 16-color


From: miha
Subject: bug#51297: 28.0.60; [PATCH] Update termcap/terminfo to indicate 16-color support
Date: Wed, 20 Oct 2021 10:29:27 +0200

Jim Porter <jporterbugs@gmail.com> writes:

> In bug#50179, I added support for bright ANSI colors, but neglected to 
> update the termcap/terminfo settings to indicate this. Attached is a 
> patch to do so. Note that it doesn't need to be merged into Emacs 29, 
> since bug#50806 already fixed this when adding 256/24-bit color support.

> -     colors#8,
> +     colors#16,

True, we now do support 16 colors, but the setab and setaf capnames have
to be adjusted as well.  For setaf, for example, the first 8 colors are
specified with sequences \e[30m - \e[37m, and the next 8 colors are
specified with sequences \e[90m - \e[97m.  There is a "gap".  See the
attached patch, which adjusts setab and setaf.

> @@ -1584,7 +1584,7 @@ term-termcap-format
>  :so=\\E[7m:se=\\E[m:us=\\E[4m:ue=\\E[m:md=\\E[1m:mr=\\E[7m:me=\\E[m\
>  :UP=\\E[%%dA:DO=\\E[%%dB:LE=\\E[%%dD:RI=\\E[%%dC\
>  :kl=\\EOD:kd=\\EOB:kr=\\EOC:ku=\\EOA:kN=\\E[6~:kP=\\E[5~:@7=\\E[4~:kh=\\E[1~\
> -:mk=\\E[8m:cb=\\E[1K:op=\\E[39;49m:Co#8:pa#64:AB=\\E[4%%dm:AF=\\E[3%%dm:cr=^M\
> +:mk=\\E[8m:cb=\\E[1K:op=\\E[39;49m:Co#16:pa#64:AB=\\E[4%%dm:AF=\\E[3%%dm:cr=^M\
>  :bl=^G:do=^J:le=^H:ta=^I:se=\\E[27m:ue=\\E[24m\
>  :kb=^?:kD=^[[3~:sc=\\E7:rc=\\E8:r1=\\Ec:"
>    ;; : -undefine ic

As for termcap, I don't think there is a way to specify this gap.  I
think it's best to just leave this unchanged.  In bug#50806, I did
adjust the number of colors in termcap, but I could do it because I
added a way to specify colors without the gap
(with \e[38;2;0m - \e[38;2;15m for setaf).

In conclusion, I think we should update the terminfo, changing colors,
setab and setaf, and leave term.el unchanged.  Patch attached.
From 158e84e403017d2bfc73d9dabeb44bb3ba48f4dc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Miha=20Rihtar=C5=A1i=C4=8D?= <miha@kamnitnik.top>
Date: Wed, 20 Oct 2021 10:24:19 +0200
Subject: [PATCH] Update terminfo to indicate 16-color support.

* etc/e/eterm-color.ti: Indicate 16-color support.
Do not merge to master.
---
 etc/e/eterm-color    | Bin 1179 -> 1227 bytes
 etc/e/eterm-color.ti |   6 +++---
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/etc/e/eterm-color b/etc/e/eterm-color
index 
bd3f5003ae620db49b89a2c1387b0ba1c836f4f1..06e8dc01ed6c136c3b8a32ae42eed81745efd1fb
 100644
GIT binary patch
delta 109
zcmbQud76`3iqV~c9|$uUD<^UnG74<0z0AZIxH*tnkI~0owZKrd+M-s~MzzEk#7<F7
awS<Z30(sWC4ARl6$jVHh$_x$A)Bym^7aLdr

delta 61
zcmX@jIh&JPiqV~c9|$uUJtuM(GIDIJz0AaDwK<Skk5Q(;P_^3FpjK5|H6@opI$9OT
JSJzO7Z~?9&4dDO)

diff --git a/etc/e/eterm-color.ti b/etc/e/eterm-color.ti
index a6ef814990..a6ed6d28ab 100644
--- a/etc/e/eterm-color.ti
+++ b/etc/e/eterm-color.ti
@@ -9,7 +9,7 @@ eterm-color|Emacs term.el terminal emulator 
term-protocol-version 0.96,
 # Any change to this file should be done at the same time with a
 # corresponding change to the TERMCAP environment variable in term.el.
 # Comments in term.el specify where each of these capabilities is implemented.
-       colors#8,
+       colors#16,
        cols#80,
        lines#24,
        pairs#64,
@@ -65,8 +65,8 @@ eterm-color|Emacs term.el terminal emulator 
term-protocol-version 0.96,
        rmul=\E[24m,
        rs1=\Ec,
        sc=\E7,
-       setab=\E[%p1%{40}%+%dm,
-       setaf=\E[%p1%{30}%+%dm,
+       setab=\E[%?%p1%{8}%<%t4%p1%d%e10%p1%{8}%-%d%;m,
+       setaf=\E[%?%p1%{8}%<%t3%p1%d%e9%p1%{8}%-%d%;m,
        sgr0=\E[m,
        smir=\E[4h,
        smul=\E[4m,
-- 
2.33.0

Attachment: signature.asc
Description: PGP signature


reply via email to

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