From 419a5fa0fd98f673660b123f5b37c99cd0b8c61b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerd=20M=C3=B6llmann?= Date: Sun, 22 Dec 2024 14:11:33 +0100 Subject: [PATCH] Fix check for underlining capability on ttys * src/term.c (tty_capable_p): Check both possible terminal capabilities for underlining. --- src/term.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/src/term.c b/src/term.c index f2d1846e488..875d4d2deff 100644 --- a/src/term.c +++ b/src/term.c @@ -2113,18 +2113,20 @@ turn_off_face (struct frame *f, struct face *face) tty_capable_p (struct tty_display_info *tty, unsigned int caps) { #ifndef HAVE_ANDROID -#define TTY_CAPABLE_P_TRY(tty, cap, TS, NC_bit) \ - if ((caps & (cap)) && (!(TS) || !MAY_USE_WITH_COLORS_P (tty, NC_bit))) \ - return 0; +# define TTY_CAPABLE_P(tty, cap, TS, NC_bit) \ + ((caps & (cap)) && (TS) && MAY_USE_WITH_COLORS_P (tty, NC_bit)) +# define TTY_CAPABLE_P_TRY(tty, cap, TS, NC_bit) \ + if (!TTY_CAPABLE_P (tty, cap, TS, NC_bit)) \ + return false; + + if (!TTY_CAPABLE_P (tty, TTY_CAP_UNDERLINE, tty->TS_enter_underline_mode, + NC_UNDERLINE) + && !TTY_CAPABLE_P (tty, TTY_CAP_UNDERLINE_STYLED, + tty->TF_set_underline_style, NC_UNDERLINE)) + return false; TTY_CAPABLE_P_TRY (tty, TTY_CAP_INVERSE, tty->TS_standout_mode, NC_REVERSE); - TTY_CAPABLE_P_TRY (tty, - TTY_CAP_UNDERLINE, tty->TS_enter_underline_mode, - NC_UNDERLINE); - TTY_CAPABLE_P_TRY (tty, - TTY_CAP_UNDERLINE_STYLED, tty->TF_set_underline_style, - NC_UNDERLINE); TTY_CAPABLE_P_TRY (tty, TTY_CAP_BOLD, tty->TS_enter_bold_mode, NC_BOLD); TTY_CAPABLE_P_TRY (tty, @@ -2135,8 +2137,7 @@ #define TTY_CAPABLE_P_TRY(tty, cap, TS, NC_bit) \ TTY_CAP_STRIKE_THROUGH, tty->TS_enter_strike_through_mode, NC_STRIKE_THROUGH); - /* We can do it! */ - return 1; + return true; #else return false; #endif -- 2.47.1