Subject: Re: bug#78807: 31.0.50; Wave underline set wrongly

From: Eli Zaretskii <[email-masked]>
Date: Sun, 22 Jun 2025 08:33:50 +0300

> Date: Sun, 22 Jun 2025 01:44:39 +0000 (UTC)
> From: Ergus <[email-masked]>
> Cc: "[email-masked]" <[email-masked]>
> 
> As far as I know the check for wave underline in terminfo may look for Smulx
> 
> I tried: `infocmp -1 | grep -E 'Smulx|Su|cul'` 
> 
> and: `tigetstr("Smulx")` in a C snippet 
> 
> and none of them return positive.
> 
> The function mentions that it uses some heuristics and that may be the problem?

This is what we do:

    /* Styled underlines.  Support for this is provided either by the
       escape sequence in Smulx or the Su flag.  The latter results in a
       common default escape sequence and is not recommended.  */
  #ifdef TERMINFO
    tty->TF_set_underline_style = tigetstr ("Smulx");
    if (tty->TF_set_underline_style == (char *) (intptr_t) -1)
      tty->TF_set_underline_style = NULL;
  #else
    tty->TF_set_underline_style = tgetstr ("Smulx", address);
  #endif
    if (!tty->TF_set_underline_style && tgetflag ("Su"))
      /* Default to the kitty escape sequence.  See
	 https://sw.kovidgoyal.net/kitty/underlines/.  */
      tty->TF_set_underline_style = "\x1b[4:%p1%dm";

    if (tty->TF_set_underline_style)
      /* Standard escape sequence to set the underline color.
	 Requires a single parameter, the color index.  */
      tty->TF_set_underline_color = "\x1b[58:2::%p1%{65536}%/%d:%p1%{256}%/%{255}%&%d:%p1%{255}%&%dm";

If tmux doesn't support this (again, please ask the tmux developers),
then we need a way to detect tmux and avoid the above.  But I'm
surprised that no one has reported this till now.  Perhaps you need to
upgrade your tmux?