GNU bug report logs - #62265
Underline does not work in Terminal Emacs

Previous Next

Package: emacs;

Reported by: Mohsin Kaleem <mohkale <at> kisara.moe>

Date: Sat, 18 Mar 2023 17:49:02 UTC

Severity: normal

Merged with 62876

Found in version 28.2

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #23 received at 62265 <at> debbugs.gnu.org (full text, mbox):

From: Mohsin Kaleem <mohkale <at> kisara.moe>
To: Jim Porter <jporterbugs <at> gmail.com>, Eli Zaretskii <eliz <at> gnu.org>
Cc: 62265 <at> debbugs.gnu.org
Subject: Re: bug#62265: Underline does not work in Terminal Emacs
Date: Sun, 19 Mar 2023 10:07:14 +0000
[Message part 1 (text/plain, inline)]
Jim Porter <jporterbugs <at> 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.

[01-fix-terminfo-strikethrough.patch (text/x-patch, inline)]
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;
[Message part 3 (text/plain, inline)]
-- 
Mohsin Kaleem

This bug report was last modified 2 years and 34 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.