(this is an experimental patch, mainly for demonstration. I haven't done
much research).

https://www.gnu.org/software/termutils/manual/termcap-1.3/html_node/termcap_33.html
presents a reason for using standout mode:

> Programs that use appearance modes only to highlight some text generally
> use the standout mode so that they can work on as many terminals as possible.

This is a nice idea, though it seems a bit dated. I'm not sure how many
applications really want to use this indirection.

Most software terminals seem support both italics and reverse mode.
Most terminals interpret standout mode as reverse mode.
The exception is GNU screen where it means italics.

According to the terminfo database on my system, terminals that do not
support italics mode (sitm) include
- Putty
- linux
- Emacs ansi-term (TERM=eterm)
---
 tty.c | 22 ++++++++--------------
 1 file changed, 8 insertions(+), 14 deletions(-)

diff --git a/tty.c b/tty.c
index 19e55757..680a0961 100644
--- a/tty.c
+++ b/tty.c
@@ -684,16 +684,14 @@ tty_putn(struct tty *tty, const void *buf, size_t len, 
u_int width)
 static void
 tty_set_italics(struct tty *tty)
 {
-       const char      *s;
+       const char      *s = options_get_string(global_options, 
"default-terminal");;
 
-       if (tty_term_has(tty->term, TTYC_SITM)) {
-               s = options_get_string(global_options, "default-terminal");
-               if (strcmp(s, "screen") != 0 && strncmp(s, "screen-", 7) != 0) {
-                       tty_putcode(tty, TTYC_SITM);
-                       return;
-               }
+       if (strcmp(s, "screen") == 0 && strncmp(s, "screen-", 7) == 0) {
+               tty_putcode(tty, TTYC_SMSO);
+               return;
        }
-       tty_putcode(tty, TTYC_SMSO);
+
+       tty_putcode(tty, TTYC_SITM);
 }
 
 void
@@ -2769,12 +2767,8 @@ tty_attributes(struct tty *tty, const struct grid_cell 
*gc,
        }
        if (changed & GRID_ATTR_BLINK)
                tty_putcode(tty, TTYC_BLINK);
-       if (changed & GRID_ATTR_REVERSE) {
-               if (tty_term_has(tty->term, TTYC_REV))
-                       tty_putcode(tty, TTYC_REV);
-               else if (tty_term_has(tty->term, TTYC_SMSO))
-                       tty_putcode(tty, TTYC_SMSO);
-       }
+       if (changed & GRID_ATTR_REVERSE)
+               tty_putcode(tty, TTYC_REV);
        if (changed & GRID_ATTR_HIDDEN)
                tty_putcode(tty, TTYC_INVIS);
        if (changed & GRID_ATTR_STRIKETHROUGH)
-- 
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-3-aclopte%40gmail.com.

Reply via email to