diff --git a/src/term.c b/src/term.c index d881dee39fe..c47cdc8bb8a 100644 --- a/src/term.c +++ b/src/term.c @@ -95,6 +95,8 @@ #define OUTPUT_IF(tty, a) \ #define OUTPUT1_IF(tty, a) do { if (a) emacs_tputs ((tty), a, 1, cmputc); } while (0) +#define TERMINFO_NON_STRING_CAP_P(cap) ((cap) == (char *) (intptr_t) -1) + /* Display space properties. */ /* Chain of all tty device parameters. */ @@ -4163,7 +4165,14 @@ init_tty (const char *name, const char *terminal_type, bool must_succeed) tty->TS_enter_alt_charset_mode = tgetstr ("as", address); tty->TS_exit_alt_charset_mode = tgetstr ("ae", address); tty->TS_exit_attribute_mode = tgetstr ("me", address); +#ifdef TERMINFO + tty->TS_enter_strike_through_mode = tigetstr ("smxx"); + if (TERMINFO_NON_STRING_CAP_P (tty->TS_enter_strike_through_mode)) { + tty->TS_enter_strike_through_mode = NULL; + } +#else tty->TS_enter_strike_through_mode = tgetstr ("smxx", address); +#endif MultiUp (tty) = tgetstr ("UP", address); MultiDown (tty) = tgetstr ("DO", address); @@ -4193,8 +4202,8 @@ init_tty (const char *name, const char *terminal_type, bool must_succeed) const char *bg = tigetstr ("setb24"); /* Non-standard support for 24-bit colors. */ if (fg && bg - && fg != (char *) (intptr_t) -1 - && bg != (char *) (intptr_t) -1) + && !TERMINFO_NON_STRING_CAP_P (fg) + && !TERMINFO_NON_STRING_CAP_P (bg)) { tty->TS_set_foreground = fg; tty->TS_set_background = bg;