From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Mohsin Kaleem Newsgroups: gmane.emacs.bugs Subject: bug#75024: [PATCH] Fix check for underlining capability on ttys Date: Sun, 05 Jan 2025 11:36:50 +0000 Message-ID: <874j2dh4q5.fsf@kisara.moe> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="7776"; mail-complaints-to="usenet@ciao.gmane.io" To: Gerd =?UTF-8?Q?M=C3=B6llmann?= , 75024@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Jan 05 12:37:09 2025 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1tUOwO-0001rd-S7 for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 05 Jan 2025 12:37:09 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tUOwK-0002nI-0T; Sun, 05 Jan 2025 06:37:04 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tUOwI-0002n9-LF for bug-gnu-emacs@gnu.org; Sun, 05 Jan 2025 06:37:02 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tUOwI-0006Ox-Cn for bug-gnu-emacs@gnu.org; Sun, 05 Jan 2025 06:37:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=mc2zDJaH40641cpccTwweD8zE3i1aKpcRE93X6GFVS0=; b=SirY3gNoPLjeQgWMZdSTbONETi4q0s58nDGR2X5y5yTbi9Vry/07a/HTsV+hfu/atxt4t7MSYSjQbzHVCOWDfjnli42NiHQ+Hy0blyEZHr/U7BvvIOlsD29bEG/CuReoHgfUC9YgTmLs68KyLYZDvbffNdYTaIuxv6D6/jY1NSX7c7+mMiHi/0IOlxKUqU58vM8dDXjrUntsaDgnZ3QwOh9LcLWxABRAzJFsim/HcfI/ttARZRBFjrTe2MOHG3r7PBhp10hCqTywyZr+p6YtuEfAXUuTwPLCRBXHKsksjUE32nfRnHmnh1Z17F0F1iTuxd73JRIfHNS3xFS3FwnS6A==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tUOwI-0005Pz-63 for bug-gnu-emacs@gnu.org; Sun, 05 Jan 2025 06:37:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Mohsin Kaleem Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 05 Jan 2025 11:37:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 75024 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 75024-submit@debbugs.gnu.org id=B75024.173607702120823 (code B ref 75024); Sun, 05 Jan 2025 11:37:02 +0000 Original-Received: (at 75024) by debbugs.gnu.org; 5 Jan 2025 11:37:01 +0000 Original-Received: from localhost ([127.0.0.1]:60170 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tUOwH-0005Pk-3n for submit@debbugs.gnu.org; Sun, 05 Jan 2025 06:37:01 -0500 Original-Received: from 119.ip-51-38-65.eu ([51.38.65.119]:54680 helo=kisara.moe) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tUOwE-0005PP-3x for 75024@debbugs.gnu.org; Sun, 05 Jan 2025 06:36:59 -0500 Original-Received: from mk-desktop (unknown [143.58.198.125]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by kisara.moe (Postfix) with ESMTPSA id 375F5A2CF0; Sun, 05 Jan 2025 12:36:51 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kisara.moe; s=default; t=1736077011; bh=OG+5LsE+ymZ6PC9NqRZWkF/xTslPvVoSwEPLJyTYqCU=; h=From:To:Subject:In-Reply-To:References:Date:From; b=VXcu3BEfRDlGy1U89F1GpI+gtWWl0QJj/J1qzhsRWYHct+JNT2ktSaQMK4vxif5Se s/ZTwlwB/R50uBodX2gqXcZTQccxV8NHq7RjQs265W2RHCSt8eiCZ81wvDpy8jDT0+ T6MFNNZDXEslfihNC5qSv/2dGDXyVO6NgTrZw80xLzKsmY9OqpgtsBipTdkPHrvf6D /Ec2KT+2SxM4BE14DTTVGPitKTJexzKECvBWyTknGdAcADyxRbfVjvvtUWO/YYKhNK 6WMlfktFH7gqNbVmjRNDd3MVbms8ZvMK7jIWDuPUzuoiQuxkTeisAFEqYcDXJvkfhv pwuXjtLP6Mi0Q== In-Reply-To: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:298544 Archived-At: Gerd M=C3=B6llmann writes: Hi there, Sorry for the late response. >> I meanwhile found this, to my great surprise: >> >> #define TTY_CAP_UNDERLINE_STYLED (0x32 & TTY_CAP_UNDERLINE) >> >> That makes TTY_CAP_UNDERLINE_STYLED =3D=3D TTY_CAP_UNDERLINE. And this t= est >> in tty_capable_p >> >> 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, >> >> fails because it tests TTY_CAP_UNDERLINE twice, and requires both >> TS_enter_underline_mode and TF_set_underline_style to be usable for >> underline support. In Terminal.app, only TS_enter_underline_mode is >> available. >> >> Maybe this should have been=20 >> >> #define TTY_CAP_UNDERLINE_STYLED 0x40 >> >> ? Ah, yep. The original intention was or a new bit flag with the existing underline bit flag so that styled underlines were only available in environments with at least regular underlines. In retrospect that was probably excessive and simply checking for styled underline support by itself (with a value of 0x40) is sufficient. I'd find it strange to have a terminal that supported styled underlines but not regular ones but there's no need to enforce this on the Emacs side. >> >> BTW, the 0x32 also also makes no sense to me because of=20 >> >> #define TTY_CAP_ITALIC 0x10 >> #define TTY_CAP_STRIKE_THROUGH 0x20 >> >> CC to the original author to check. Correct here as well, I should've confirmed the binary representation :-(. 0b00000000000000000000000000010000 0o00000000020 0d0000000016 0x00000010 0b00000000000000000000000000100000 0o00000000040 0d0000000032 0x00000020 0b00000000000000000000000000110010 0o00000000062 0d0000000050 0x00000032 0b00000000000000000000000001000000 0o00000000100 0d0000000064 0x00000040 0x40 is what the next entry in the flag should have been. --=20 Mohsin Kaleem