From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id KasYFA8XLGpxTAMAWB0awg (envelope-from ) for ; Fri, 12 Jun 2026 10:26:23 -0400 Authentication-Results: simark.ca; dkim=fail reason="signature verification failed" (768-bit key; unprotected) header.d=tromey.com header.i=@tromey.com header.a=rsa-sha256 header.s=default header.b=wd2YvcbE; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 4DCB11E098; Fri, 12 Jun 2026 10:26:23 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-5.1 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_INVALID,DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H2 autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [38.145.34.32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id DE0831E070 for ; Fri, 12 Jun 2026 10:26:22 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 647304B920CC for ; Fri, 12 Jun 2026 14:26:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 647304B920CC Authentication-Results: sourceware.org; dkim=fail reason="signature verification failed" (768-bit key, unprotected) header.d=tromey.com header.i=@tromey.com header.a=rsa-sha256 header.s=default header.b=wd2YvcbE Received: from omta36.uswest2.a.cloudfilter.net (omta36.uswest2.a.cloudfilter.net [35.89.44.35]) by sourceware.org (Postfix) with ESMTPS id 058584BA23D3 for ; Fri, 12 Jun 2026 14:25:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 058584BA23D3 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tromey.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 058584BA23D3 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=35.89.44.35 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1781274327; cv=none; b=wIa5wSSkzufbyeal1bw6t5yhGOXaVT99VJnyNwGTffbtK+lUrzNUOc4LYRCET5kdAy6Ql0DZHu9K/igYW6yI0aS754mJDXfHkEvgiOvX8rKYGrCm7MS4HCc/mfZXsRD/XUCNtMr4PkIB9KmO8uihilgu+YsZbnQD3XP8NGJBMn8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1781274327; c=relaxed/simple; bh=PFechL7HfiQNOU4SN4NNdFfH1sCmKE8o2cDvaJUmDRE=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=xriNEE3KDgeC99rgLZNjvqdi/kWa+TbgOzPmgSgI+K0tVjXi+P0yXnw5FP/njHlk/hAIxsfi6e5NodWOTpks6gCVR1ePbtWletD0hQor5pBp2GNAioF5H9mKPtq7Qa7nlXbhAbLlghfJ8XBibIGDdo9cW/u4f76Et1tQfycsmm4= ARC-Authentication-Results: i=1; sourceware.org; dkim=policy (768-bit key, unprotected) header.d=tromey.com header.i=@tromey.com header.a=rsa-sha256 header.s=default header.b=wd2YvcbE reason="signing key too small" DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 058584BA23D3 Received: from eig-obgw-6006b.ext.cloudfilter.net ([10.0.30.211]) by cmsmtp with ESMTPS id Y1aKwiR6oPpWVY2p4wmGjV; Fri, 12 Jun 2026 14:25:26 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id Y2p2w9YMAWBahY2p3wfHiE; Fri, 12 Jun 2026 14:25:25 +0000 X-Authority-Analysis: v=2.4 cv=Y9D4sgeN c=1 sm=1 tr=0 ts=6a2c16d5 a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=IkcTkHD0fZMA:10 a=FelO9ux0wxsA:10 a=ItBw4LHWJt0A:10 a=-rEXgCYeI4tHpfwPelMA:9 a=QEXdDO2ut3YA:10 a=DCx65vhANUyCzuf5D8fC:22 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Cc:To:In-Reply-To:References:Message-Id: Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date:From:Sender: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=LP2tWFxXq00lqI5umG4JZbd7gFmsv7xucnjIO1RDLR0=; b=wd2YvcbEGrGenDQi3pxo+upt7T V9SOfRAaIuyY9TNWmsT7jv1ihwi4X9ejXmeRa4sKLaQQCJkQXpKhZRYhVI+z5qOFgV5Db8hdNraQ9 6Ib9zxvpbdfCx7CU9uMb5LV0m; Received: from 75-166-225-82.hlrn.qwest.net ([75.166.225.82]:50348 helo=[192.168.122.1]) by box5379.bluehost.com with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.99.2) (envelope-from ) id 1wY2p2-00000001fM4-3JkY; Fri, 12 Jun 2026 08:25:24 -0600 From: Tom Tromey Date: Fri, 12 Jun 2026 08:25:24 -0600 Subject: [PATCH 4/5] Add ui_file_style::merge MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20260612-submit-zebra-style-v1-4-cfd00b5c984c@tromey.com> References: <20260612-submit-zebra-style-v1-0-cfd00b5c984c@tromey.com> In-Reply-To: <20260612-submit-zebra-style-v1-0-cfd00b5c984c@tromey.com> To: gdb-patches@sourceware.org Cc: Tom Tromey X-Mailer: b4 0.14.3 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - sourceware.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 75.166.225.82 X-Source-L: No X-Exim-ID: 1wY2p2-00000001fM4-3JkY X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 75-166-225-82.hlrn.qwest.net ([192.168.122.1]) [75.166.225.82]:50348 X-Source-Auth: tom+tromey.com X-Email-Count: 5 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfGBTPC9ZvzoLI/6DDehii/3Zx8d/oby0pgt6i6CQzOvbj/Xu4AfYL4pWd0WAXzV428i7rRhC8b3J0jOLJeXKl7KtzbecbbAxeUJKTHIMie8mf406nVXz CcGJFz6xkxVMnnVvdc5/fLQk/huzIFw5wV/6yDdZRxSe4sREG1nRIyCdQup5PKjqiTGJ17FiGUg5KPQKPsE5vH0sdGaOk5E5qFs= X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org This adds ui_file_style::merge, a new method allowing two styles to be merged together. --- gdb/ui-style.h | 15 +++++++++++++++ gdb/unittests/style-selftests.c | 8 ++++++++ 2 files changed, 23 insertions(+) diff --git a/gdb/ui-style.h b/gdb/ui-style.h index 52f5a5a104d..53df949bd85 100644 --- a/gdb/ui-style.h +++ b/gdb/ui-style.h @@ -419,6 +419,21 @@ struct ui_file_style return this; } + /* Combine STYLE with this style, returning a new merged style. Any + non-"empty" attributes of STYLE override the corresponding + attributes of this style. */ + ui_file_style merge (const ui_file_style &style) const + { + ui_file_style result = *this; + if (!style.m_foreground.is_none ()) + result.m_foreground = style.m_foreground; + if (!style.m_background.is_none ()) + result.m_background = style.m_background; + result.m_intensity = style.m_intensity; + result.m_reverse = style.m_reverse; + return result; + } + /* nullptr-terminated list of names corresponding to enum basic_color. */ static const std::vector basic_color_enums; diff --git a/gdb/unittests/style-selftests.c b/gdb/unittests/style-selftests.c index 9035050bd6c..0fa8074f719 100644 --- a/gdb/unittests/style-selftests.c +++ b/gdb/unittests/style-selftests.c @@ -119,6 +119,14 @@ run_tests () SELF_CHECK (!style.is_underline ()); SELF_CHECK (style.is_reverse ()); SELF_CHECK (style.to_ansi () == "\033[38;2;83;84;85;48;2;0;1;254;2;23;24;7m"); + + const ui_file_style redblack_style (ui_file_style::RED, ui_file_style::BLACK); + const ui_file_style rednone_style (ui_file_style::RED, ui_file_style::NONE); + const ui_file_style noneblack_style (ui_file_style::NONE, ui_file_style::BLACK); + SELF_CHECK (ui_file_style ().merge (redblack_style) == redblack_style); + SELF_CHECK (redblack_style.merge ({}) == redblack_style); + SELF_CHECK (rednone_style.merge (noneblack_style) == redblack_style); + SELF_CHECK (noneblack_style.merge (rednone_style) == redblack_style); } } /* namespace style */ -- 2.49.0