Subject: Re: bug#62994: [PATCH 3/3] Add support for colored underlines on tty frames

From: Eli Zaretskii <[email-masked]>
Date: Fri, 21 Apr 2023 19:12:54 +0300

> Cc: Mohsin Kaleem <[email-masked]>
> From: [email-masked]
> Date: Fri, 21 Apr 2023 15:34:48 +0100
> 
> diff --git a/etc/NEWS b/etc/NEWS
> index 9f34927dfad..46b2b0e25c5 100644
> --- a/etc/NEWS
> +++ b/etc/NEWS
> @@ -1917,20 +1917,23 @@ exist, the command creates it first.  You can use this command if you
>  inadvertently delete the "*scratch*" buffer.
>  
>  ---
> -** Support for 'styled-underline' face attributes on TTY frames
> +** Support for 'styled' and 'colored' underline face attributes on TTY frames
>  If your terminals termcap or terminfo database entry has the 'Su' or
>  'Smulx' capability defined, Emacs will now emit the prescribed escape
>  sequence necessary to render faces with styled underlines on TTY
>  frames.
>  
>  Styled underlines are any underlines containing a non-default
> -underline style.  The available underline styles for TTY frames are
> -'double', 'wave', 'dotted', and 'dashed'.
> +underline style or a color other than the foreground-color.
> +The available underline styles for TTY frames are 'double', 'wave',
> +'dotted', and 'dashed'.
>  
>  The 'Smulx' capability should define the actual sequence needed to
>  render styled underlines. If ommitted, but the 'Su' flag is defined,
>  then a default sequence will be used. It's recommended to use 'Smulx'
> -instead of 'Su', with priority being given to 'Smulx'.
> +instead of 'Su', with priority being given to 'Smulx'.  Support for
> +colored underlines is automatically enabled with a default escape
> +sequence when styled underline are supported.

Please don't break the changeset into several patches, not in this
case: this changeset introduces a feature that there's no reason to
break into several sub-features, so making a single patch will make it
easier to review the changes.

> +      ts = tty->TF_set_underline_color;
> +      if (ts && face->underline_color)
> +	{
> +          p = tparam (ts, NULL, 0, face->underline_color, 0, 0, 0);

It looks like your edits use indentation with only spaces.  Our style
in C sources is to use TABs and spaces, so please set up your Emacs to
follow our style (it should happen automatically if you let Emacs read
and follow the .dir-locals.el file in the Emacs repository).

> +  if (tty->TF_set_underline_style)
> +    tty->TF_set_underline_color = "\x1b[58:2::%p1%{65536}%/%d:%p1%{256}%/%{255}%&%d:%p1%{255}%&%dm";

What is the source for this escape sequence? can you mention it in a
comment?

Thanks.