Given

        for i in $(seq 5); do
            printf '\e[4:${i}m%s\e[m\n' "underline style $i"
        done

when terminfo doesn't advertise the Smulx capability, we fall back to emitting
regular underlines.

I use curly underlines to highlight syntax errors in my interactive shell.
I don't want the fallback because in this context, a regular underline means
something else (namely that a file path exists).

Remove the smart fallback, matching what most (non-multiplexing) terminals do.

This might annoy some users, in particular those using TUI programs that
do not allow setting their text face that results in the program sending
'\e[4m\e[4:2m' (underline followed by double underline). I guess that not
many programs enable styled underlines by default. For example, Neovim seems
to use regular underlines for errors.

Other instances of this fallback pattern are that we downgrade both reverse
and italics mode to standout mode if they are missing.  Perhaps we should
try to remove those as well, for consistency (sketched in the next patch).
---
 tty.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/tty.c b/tty.c
index bfedb8ee..19e55757 100644
--- a/tty.c
+++ b/tty.c
@@ -2756,8 +2756,7 @@ tty_attributes(struct tty *tty, const struct grid_cell 
*gc,
        if (changed & GRID_ATTR_ITALICS)
                tty_set_italics(tty);
        if (changed & GRID_ATTR_ALL_UNDERSCORE) {
-               if ((changed & GRID_ATTR_UNDERSCORE) ||
-                   !tty_term_has(tty->term, TTYC_SMULX))
+               if (changed & GRID_ATTR_UNDERSCORE)
                        tty_putcode(tty, TTYC_SMUL);
                else if (changed & GRID_ATTR_UNDERSCORE_2)
                        tty_putcode_i(tty, TTYC_SMULX, 2);
-- 
2.49.0

-- 
You received this message because you are subscribed to the Google Groups 
"tmux-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tmux-users+unsubscr...@googlegroups.com.
To view this discussion, visit 
https://groups.google.com/d/msgid/tmux-users/20250503190316.409246-2-aclopte%40gmail.com.

Reply via email to