unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Mohsin Kaleem <mohkale@kisara.moe>
To: Jim Porter <jporterbugs@gmail.com>, Eli Zaretskii <eliz@gnu.org>
Cc: 62265@debbugs.gnu.org
Subject: bug#62265: Underline does not work in Terminal Emacs
Date: Sun, 19 Mar 2023 10:07:14 +0000	[thread overview]
Message-ID: <87mt49jbql.fsf@kisara.moe> (raw)
In-Reply-To: <7cf462de-97f7-26ef-a33f-e3ff59c8b55e@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 326 bytes --]

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.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 01-fix-terminfo-strikethrough.patch --]
[-- Type: text/x-patch, Size: 1531 bytes --]

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;

[-- Attachment #3: Type: text/plain, Size: 19 bytes --]


-- 
Mohsin Kaleem

  reply	other threads:[~2023-03-19 10:07 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-18 17:40 bug#62265: Underline does not work in Terminal Emacs Mohsin Kaleem
2023-03-18 17:51 ` Mohsin Kaleem
2023-03-18 17:55 ` Eli Zaretskii
2023-03-18 18:50   ` Jim Porter
2023-03-19 10:07     ` Mohsin Kaleem [this message]
2023-03-19 11:37       ` Eli Zaretskii
2023-03-19 11:51         ` Mohsin Kaleem
2023-03-19 12:24           ` Eli Zaretskii
2023-04-16  6:22             ` Eli Zaretskii
2023-03-18 18:01 ` Eli Zaretskii
2023-03-18 18:07   ` Mohsin Kaleem

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87mt49jbql.fsf@kisara.moe \
    --to=mohkale@kisara.moe \
    --cc=62265@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=jporterbugs@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).