bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#62265: Underline does not work in Terminal Emacs


From: Mohsin Kaleem
Subject: bug#62265: Underline does not work in Terminal Emacs
Date: Sun, 19 Mar 2023 10:07:14 +0000

Jim Porter <jporterbugs@gmail.com> writes:

Hi, so turns out terminfo returns a max-ptr for tigetstr when the
terminfo definition is missing. There's checks for this for setb24 and
setf24 but not in the patch I supplied. Updated to check this and added
a macro definition to avoid repeating the same condition logic 3 times.

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;
-- 
Mohsin Kaleem

reply via email to

[Prev in Thread] Current Thread [Next in Thread]