From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#62994: [PATCH v6] Add support for colored and styled underlines on tty frames Date: Sat, 20 Apr 2024 11:16:44 +0300 Message-ID: <868r18a1oz.fsf@gnu.org> References: <20240414135632.432193-1-mohkale@kisara.moe> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33232"; mail-complaints-to="usenet@ciao.gmane.io" Cc: mohkale@kisara.moe, 62994@debbugs.gnu.org To: mohkale@kisara.moe Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Apr 20 10:18:08 2024 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 1ry5vE-0008T0-Ed for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 20 Apr 2024 10:18:08 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ry5uv-0002QM-IG; Sat, 20 Apr 2024 04:17:49 -0400 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 1ry5uu-0002QD-Kn for bug-gnu-emacs@gnu.org; Sat, 20 Apr 2024 04:17:48 -0400 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 1ry5uu-0007FR-CJ for bug-gnu-emacs@gnu.org; Sat, 20 Apr 2024 04:17:48 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ry5v8-0001zg-FI for bug-gnu-emacs@gnu.org; Sat, 20 Apr 2024 04:18:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 20 Apr 2024 08:18:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62994 X-GNU-PR-Package: emacs Original-Received: via spool by 62994-submit@debbugs.gnu.org id=B62994.17136010367268 (code B ref 62994); Sat, 20 Apr 2024 08:18:02 +0000 Original-Received: (at 62994) by debbugs.gnu.org; 20 Apr 2024 08:17:16 +0000 Original-Received: from localhost ([127.0.0.1]:35011 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ry5uL-0001sy-Pi for submit@debbugs.gnu.org; Sat, 20 Apr 2024 04:17:15 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:34056) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ry5uG-0001sC-KK for 62994@debbugs.gnu.org; Sat, 20 Apr 2024 04:17:11 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ry5tw-00071e-CP; Sat, 20 Apr 2024 04:16:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=TjgYnEbQLA9LdsQgoP1zWBnI96LqOBgVryPWtGbC0o4=; b=qfZVvXjxPZF0 LLRntItqVh+FIqVJArh0yLpst4jAWw5V4jxc8apNavhdMS7VqovigApjhjRehCI8n1vlokzKtWqRG 7VL1r18ertOuy2NvtI5f4jjOEpK1/fhRm+6OyNrIL3hirvy7+G5qoGiRQWVCkx4wqWj2LkfonU50q mKitQRt4NIBQzy419NodiMLRmRxzYXHTylbkbw763qRKq9DY5kF/0BqSUa0TElZtQOmBR9sHE+ObI bMw8B9L632kDsAdIgLPrST7ExFxmuGWT/sxZbjLNWu8qL7Pfu960AVoz8OrUXUuhbaia3z4gZiUtI KPsZHlEwzPRsLqW9NLMSEg==; In-Reply-To: <20240414135632.432193-1-mohkale@kisara.moe> 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:283722 Archived-At: > Cc: Mohsin Kaleem > From: mohkale@kisara.moe > Date: Sun, 14 Apr 2024 14:56:32 +0100 The Subject line is longer than 78 characters, so our commit hooks didn't allow me to apply this. Please make the Subject line shorter, possibly by dropping the bug number (mention the bug number somewhere in the rest of the log message). > * src/dispextern.h (face, face_underline_type, syms_of_xfacse, > internal-set-lisp-face-attribute, gui_supports_face_attributes_p): > Add definitions for new underline styles of Double-line, Dots and > Dashes. Rename FACE_UNDER_LINE and FACE_UNDER_WAVE to make definitions > consistent. Delete tty_underline_p from the face struct and use just > underline going forward. Add a flag to check whether styled underlines > are available. > * lisp/cus-face.el (custom-face-attributes): Add entries for Double-line, > Dots and Dashes so they can be set through `customize'. > * src/termchar.c (tty_display_info): Add an entry for the escape > sequence to set the underline style and color on terminal frames. > * src/term.c (init_tty, tty_capable_p, turn_on_face): Read and save the > underline style escape sequence from the Smulx termcap (alternatively if > the Su flag is set use a default sequence). Allow checking for support > of styled underlines in the current terminal frame. Output the necessary > escape sequences to activate a styled underline on turn_on_face; this is > currently only used for the new special underline styles, a default > straight underline will still use the "us" termcap. Output escape > sequence to set underline color when set in the face and supported by > the tty. Save a default value for this sequence on init_tty when styled > underlines are supported. > * src/xfaces.c (tty_supports_face_attributes_p, realize_tty_face, > map_tty_color): Assert whether styled underlines are supported by the > current terminal on display-supports-face-attributes-p checks. Populate > the correct underline style and color in the face spec when realizing a > face. Allow map_tty_color to map underline colors alongside foreground > and background. The interface of map_tty_color was amended to allow the > caller to supply the underline color instead of accessing it through the > face attributes. > * src/xterm.c (x_draw_glyph_string): Updated to use renamed > FACE_UNDERLINE_SINGLE and FACE_UNDERLINE_WAVE face_underline_type > enumerations. These lines are also too long, and don't follow our conventions. I suggest to use change-log-mode to format and fill those correctly. > + if (!tty->TF_set_underline_style && tgetflag ("Su")) > + /* Default to the kitty escape sequence. See > + https://sw.kovidgoyal.net/kitty/underlines/ */ Period missing at the end of the comment. Also, please leave two spaces between the end of the comment and the closing "*/", per our conventions. > + /* Check supported underline styles. */ > + val = attrs[LFACE_UNDERLINE_INDEX]; > + if (!UNSPECIFIEDP (val)) > + if (EQ (CAR_SAFE (val), QCstyle)) > + if (!(EQ (CAR_SAFE (CDR_SAFE (val)), Qline) > + || EQ (CAR_SAFE (CDR_SAFE (val)), Qwave))) > + return false; /* Unsupported underline style. */ Can this be written in a cleaner way, as a single 'if' with all the conditions combined together, instead of nesting them? > - return false; /* same as default */ > + return false; /* same as default */ Why this whitespace change? Thanks.