Subject: bug#62265: Underline does not work in Terminal Emacs

From: Eli Zaretskii <[email-masked]>
Date: Sat, 18 Mar 2023 19:55:03 +0200

> From: Mohsin Kaleem <[email-masked]>
> Date: Sat, 18 Mar 2023 17:40:51 +0000
> 
> Underline support for tty frames was added to Emacs back in the Emacs
> 28.0.90 release. It hasn't worked for me since. Today I tried
> investigating why. I tracked it down ncurses and discovered the tgetstr
> function to retrieve the escape sequence for underline support doesn't
> fetch the value configured in the terminfo database for my Terminal
> (st). I can reproduce this function failing to fetch the entry in a
> minimal sample program (code attached).
> 
> The cause for this seems to be in ncurses directly. In the definition of
> tgetstr in lib_termcap.c there's a check for ValidExt for any
> non-standard terminfo entries. This macro fails when fetching an entry
> that is longer than 2 characters, meaning tgetstr for "smxx" fails and I
> get no underlines. I've managed to fix this by using tigetstr in-place
> of tgetstr (this variant is also used for querying the setf24 and setb24
> termcaps already in "term.c" so I suspect this is a known issue). I'm
> not sure what the termcap library does but I'm guessing it doesn't have
> this restriction.
> 
> Please fix this by switching to tigetstr instead of tgetstr for this
> record when building with terminfo. I've got a sample patch for this
> attached.

Thanks.  Can someone with access to such a terminal please verify the
issue with ncurses, and also verify the proposed change?