unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: miha--- via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Jim Porter <jporterbugs@gmail.com>, 51297@debbugs.gnu.org
Subject: bug#51297: 28.0.60; [PATCH] Update termcap/terminfo to indicate 16-color support
Date: Wed, 20 Oct 2021 10:29:27 +0200	[thread overview]
Message-ID: <87y26om74o.fsf@miha-pc> (raw)
In-Reply-To: <5317d810-ac3c-23e3-e017-a057406ec6b8@gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 1697 bytes --]

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.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0001-Update-terminfo-to-indicate-16-color-support.patch --]
[-- Type: text/x-patch, Size: 1717 bytes --]

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 #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 861 bytes --]

  reply	other threads:[~2021-10-20  8:29 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-19 23:49 bug#51297: 28.0.60; [PATCH] Update termcap/terminfo to indicate 16-color support Jim Porter
2021-10-20  8:29 ` miha--- via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2021-10-20 19:50   ` Jim Porter
2021-10-20 21:06     ` miha--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-10-30 15:53       ` Stefan Kangas
2021-11-04 23:20   ` Lars Ingebrigtsen
2021-11-04 23:47     ` Jim Porter
2021-11-05  2:27       ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87y26om74o.fsf@miha-pc \
    --to=bug-gnu-emacs@gnu.org \
    --cc=51297@debbugs.gnu.org \
    --cc=jporterbugs@gmail.com \
    --cc=miha@kamnitnik.top \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).