From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Robert Pluim Newsgroups: gmane.emacs.bugs Subject: bug#62994: [PATCH v2 1/1] Add support for colored and styled underlines on tty frames Date: Mon, 24 Apr 2023 11:21:43 +0200 Message-ID: <87sfcpbpp4.fsf@gmail.com> References: <20230421192433.579140-1-mohkale@kisara.moe> <20230421192433.579140-2-mohkale@kisara.moe> 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="28236"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Eli Zaretskii , 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 Mon Apr 24 11:22:13 2023 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 1pqsOh-00073P-WA for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 24 Apr 2023 11:22:12 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pqsOb-0006JG-Ew; Mon, 24 Apr 2023 05:22:06 -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 1pqsOY-0006Gl-0s for bug-gnu-emacs@gnu.org; Mon, 24 Apr 2023 05:22:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pqsOX-0004Zm-OI for bug-gnu-emacs@gnu.org; Mon, 24 Apr 2023 05:22:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pqsOX-0008OT-Jj for bug-gnu-emacs@gnu.org; Mon, 24 Apr 2023 05:22:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Robert Pluim Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 24 Apr 2023 09:22:01 +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.168232811432251 (code B ref 62994); Mon, 24 Apr 2023 09:22:01 +0000 Original-Received: (at 62994) by debbugs.gnu.org; 24 Apr 2023 09:21:54 +0000 Original-Received: from localhost ([127.0.0.1]:47531 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pqsOQ-0008O7-2R for submit@debbugs.gnu.org; Mon, 24 Apr 2023 05:21:54 -0400 Original-Received: from mail-wm1-f43.google.com ([209.85.128.43]:61787) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pqsON-0008Nt-Ii for 62994@debbugs.gnu.org; Mon, 24 Apr 2023 05:21:52 -0400 Original-Received: by mail-wm1-f43.google.com with SMTP id 5b1f17b1804b1-3f1950f5676so29961555e9.3 for <62994@debbugs.gnu.org>; Mon, 24 Apr 2023 02:21:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682328105; x=1684920105; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:from:to:cc:subject:date:message-id :reply-to; bh=IwUvFTrTku2uHuRl8/j6BwBvKqn/gvsB97A0hY1Qido=; b=kW5mThTjS3+YwadZsiarnem2Y8FnlSE7k+x/CgqXFCkVAgxJJadoniekxY1CmLeYE2 VXhh1QfxX957/IPIh3bCK4mY+l7o3nBhnpiDk1sGcDW+/f+O4njPnIKojWOr1pdAR3q1 eBIvL2rPUMS6zqu+ufXyTnZJSDDbeXVPA7yUnKVlbopuGlQ8Sd1Lwb02eozhJTvSdydF yYonIlpDH9aPVsWcmXjP1UV9Q0eDbcXOJtA50R6AEsskmOdOsnI/UpShCeEsWoWHHWm6 sJrIQ3uImziVCcWbKLfEXCHvs99EjHaNO3FtqkQ+PisYSno2+hKbq9XP01ouYOsJsZKM DCNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682328105; x=1684920105; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=IwUvFTrTku2uHuRl8/j6BwBvKqn/gvsB97A0hY1Qido=; b=D4pU+xu04rVu4F7HwjG/X3/hSEPO+L3llK4/0sjk3t89pJMiZCh41tHsva22SFJcCz Y7WodITyg4PYWzWmEevS+IfCRwfIfORi8XvdrSLvckw4j1ZYYCcyKKGean5hEFbZFUYF 72Zjs0+8Kd6vfVDe0e4zyyehr0oMFcsvRyq+vehUtaLZl9wCrNgm4nFpPPQmWPQEtjIO CdUxRWdTs2NJGUbO+Tp/Rmawy9m0tb/lUjWX3PXifnbL0UKfdWWqGCa2tLjMvLqJj+/q e8tUvNvjANnhhXiaXBC0qxQlffXVa5UVzIKnz7UfHU92787bBdTf5U+/mGM2qw3pc1TO oVjQ== X-Gm-Message-State: AAQBX9fKQjAK9lLy5dgtrGr+SX2I694GlUwOIedW4CRIQBQr82VroP9n hl02reHdG/GfVNXn+L783xPPYXfFpi0= X-Google-Smtp-Source: AKy350ZtWEczGaVZKVD2wICovl4Ij0hGVBs+NRsYrzPvajR5PKu/QJDIFKBUnso523r9yDhFa/8XDg== X-Received: by 2002:a1c:4b1a:0:b0:3ef:561d:255d with SMTP id y26-20020a1c4b1a000000b003ef561d255dmr6372939wma.41.1682328105177; Mon, 24 Apr 2023 02:21:45 -0700 (PDT) Original-Received: from rltb ([82.66.8.55]) by smtp.gmail.com with ESMTPSA id w9-20020a05600c474900b003f17e37ce60sm15077683wmo.47.2023.04.24.02.21.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Apr 2023 02:21:44 -0700 (PDT) In-Reply-To: <20230421192433.579140-2-mohkale@kisara.moe> (mohkale@kisara.moe's message of "Fri, 21 Apr 2023 20:24:33 +0100") 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:260554 Archived-At: >>>>> On Fri, 21 Apr 2023 20:24:33 +0100, mohkale@kisara.moe said: Mohsin> From: Mohsin Kaleem Mohsin> * src/dispextern.h (face, face_underline_type, Mohsin> syms_of_xfacse, This typo tell me you=CA=BCre not using 'C-x 4 a' to generate your ChangeLog entries. =20 Mohsin> +--- Mohsin> +** Support for 'styled' and 'colored' underline face Mohsin> attributes on TTY frames Full stop at the end of the sentence please. Mohsin> + if (face->underline && MAY_USE_WITH_COLORS_P (tty, NC_UNDERL= INE)) Mohsin> + { Mohsin> + if (face->underline =3D=3D FACE_UNDER_LINE Mohsin> + || !tty->TF_set_underline_style) Mohsin> + OUTPUT1_IF (tty, tty->TS_enter_underline_mode); Mohsin> + else if (tty->TF_set_underline_style) Mohsin> + { Mohsin> + char *p; Mohsin> + p =3D tparam(tty->TF_set_underline_style, NULL, 0, face->und= erline, 0, 0, 0); Mohsin> + OUTPUT (tty, p); Mohsin> + xfree (p); Mohsin> + } Mohsin> + } space before '(' please. Mohsin> else if (EQ (key, QCstyle) Mohsin> - && !(EQ (val, Qline) || EQ (val, Qwave)= )) Mohsin> + && !(EQ (val, Qline) Mohsin> + || EQ (val, Qdouble) Mohsin> + || EQ (val, Qwave) Mohsin> + || EQ (val, Qdotted) Mohsin> + || EQ (val, Qdashed))) If this was in lisp I=CA=BCd expect to see `memq', but we work with what we have :-) Mohsin> + /* Check supported underline styles. */ Mohsin> + val =3D attrs[LFACE_UNDERLINE_INDEX]; Mohsin> + if (!UNSPECIFIEDP (val)) Mohsin> + { Mohsin> + if (EQ (CAR_SAFE (val), QCstyle)) Mohsin> + { Mohsin> + if (!(EQ (CAR_SAFE (CDR_SAFE (val)), Qline) Mohsin> + || EQ (CAR_SAFE (CDR_SAFE (val)), Qwave))) Mohsin> + { Mohsin> + return false; /* Unsupported underline style */ Mohsin> + } Mohsin> + } Mohsin> + } Mohsin> + Mohsin> /* Everything checks out, this face is supported. */ Mohsin> return true; Mohsin> } Your TAB usage here still looks wrong Mohsin> @@ -5390,15 +5409,26 @@ tty_supports_face_attributes_p (struct = frame *f, Mohsin> val =3D attrs[LFACE_UNDERLINE_INDEX]; Mohsin> if (!UNSPECIFIEDP (val)) Mohsin> { Mohsin> - if (STRINGP (val)) Mohsin> - return false; /* ttys can't use colored underlines */ Mohsin> - else if (EQ (CAR_SAFE (val), QCstyle) && EQ (CAR_SAFE (C= DR_SAFE (val)), Qwave)) Mohsin> - return false; /* ttys can't use wave underlines */ Mohsin> - else if (face_attr_equal_p (val, def_attrs[LFACE_UNDERLI= NE_INDEX])) Mohsin> - return false; /* same as default */ Mohsin> - else Mohsin> - test_caps |=3D TTY_CAP_UNDERLINE; Mohsin> - } Mohsin> + if (STRINGP (val)) Mohsin> + test_caps |=3D TTY_CAP_UNDERLINE_STYLED; Mohsin> + else if (EQ (CAR_SAFE (val), QCstyle)) Mohsin> + { Mohsin> + if (!(EQ (CAR_SAFE (CDR_SAFE (val)), Qline) Mohsin> + || EQ (CAR_SAFE (CDR_SAFE (val)), Qdouble) Mohsin> + || EQ (CAR_SAFE (CDR_SAFE (val)), Qwave) Mohsin> + || EQ (CAR_SAFE (CDR_SAFE (val)), Qdotted) Mohsin> + || EQ (CAR_SAFE (CDR_SAFE (val)), Qdashed))) Mohsin> + { Mohsin> + return false; /* Face uses an unsupported underline style. = */ Mohsin> + } Mohsin> + Mohsin> + test_caps |=3D TTY_CAP_UNDERLINE_STYLED; Mohsin> + } Mohsin> + else if (face_attr_equal_p (val, def_attrs[LFACE_UNDERLINE_IN= DEX])) Mohsin> + return false; /* same as default */ Mohsin> + else Mohsin> + test_caps |=3D TTY_CAP_UNDERLINE; Mohsin> + } And here. Robert --=20