From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id nKr9I8yLVWjwKRYAWB0awg (envelope-from ) for ; Fri, 20 Jun 2025 12:26:52 -0400 Received: by simark.ca (Postfix, from userid 112) id 8076F1E11C; Fri, 20 Jun 2025 12:26:52 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-9.0 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED, RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE autolearn=ham autolearn_force=no version=4.0.1 Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (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 AD8361E089 for ; Fri, 20 Jun 2025 12:26:51 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 4A03D398ABA5 for ; Fri, 20 Jun 2025 16:25:08 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4A03D398ABA5 Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com [209.85.221.47]) by sourceware.org (Postfix) with ESMTPS id 6B3B93809FFF for ; Fri, 20 Jun 2025 16:22:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6B3B93809FFF Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=palves.net Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 6B3B93809FFF Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=209.85.221.47 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1750436563; cv=none; b=TeafVHvD0t3R5U/aU3uXAcn7aYzF3T6j9A0BM2gcxZE+PLi6ptxzM15yaxCapbB4H+lccDY54ssMosUTXeJlV2nSNcRVwMhucKEokJsuHrFDn15o0oLA1Qfy+3ybAvIn3KR9QQksMCcNAj37LVCF0KWsihu4n6JDKDmZMYW6itY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1750436563; c=relaxed/simple; bh=db9UdJ4tcV5DedPTMolcI71rx/ynQIg8aWUbPZ7M8uE=; h=Message-ID:Date:MIME-Version:Subject:To:From; b=on947TrsnlJSDCizOOToyKBVDg5Mw/NCg9CRtEA46OThC/12waGZ0g9rZuReHMPFlFQ2afStKjp3QCT2h7YkkPypm37HU2MMpgsJPhnNHS7JsbY2ubbxixCwA8ssmqP1Lnu9ZXtRXOa7P/gyUS//TekGe5w4KRAe+qsdYVl7TkE= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6B3B93809FFF Received: by mail-wr1-f47.google.com with SMTP id ffacd0b85a97d-3a503d9ef59so1481848f8f.3 for ; Fri, 20 Jun 2025 09:22:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1750436562; x=1751041362; h=content-transfer-encoding:in-reply-to:content-language:from :references:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=pjGI3Lyp/CGt0wymN2s/gINgLAS8a7kDzNSFRi9CPUU=; b=TRWZNuTZ4i+rgDIMX6VUJdSmY+aAExvxinPiyD1zK77t+Xtax9wzZH+wp9ZNqwLusj OXDZZhZcdRvcz9lBDzWq/lWgzWyFGlZU8zrtRTIzm6U+jcshHR/yYbexJso+5bHzxGrp j7SgTrL33Eavg6dxnb34SKyX8dbAMq9OZ7Hso2RX9ZSQq1KnWu5yaH5QeblhuNCSO1oY 6glNO+3lu6Btg8S02eyB4NT/5GcWDW40kvntI7MjBa/pSZBHxpnLe7d8v1CNP9eKlwmV ufvlqyiXoq9Xka/8IT59/i6OcuIeBqG5uLqQKFyF91CP00GZD+ZWxgdWpbzboQjbWShX okVw== X-Gm-Message-State: AOJu0YxVws3gerjrkRJ+E60FMWIq8C6yxrmnnWhpmg3FdXH/PbE29+Q5 xSGj0T+JqdFLCwHEGQC6ZcjLUrtCbN0rLIe/Gh55wL84Q5uPS9TJelzIlhmz9dSR X-Gm-Gg: ASbGncuKeoQF8mC6DoVOnlkjWTlZBa6Xero5qGdDXOWI1i8nRKPE246CsnRQvt5s8qK vOxUxDfcTWPR7YuKWvUFE68+wMrL3KFB4pQALiYiJJttzQUTRvcG33DGZPTWiKqhTPGN4ATBRP4 aVqKp4K8kOkmiT75R9aISM5tRXofTtU7VgZ9JEPt4BCTKPepczG7qhcUDM8f3oVo48zVIM7WqMW /PUqIwrf5zRGGh0gbuocBBKBAMOECRd8UzX90WmZS4NRn0YPWgImum+88zxbA30TbJm4aXF1oBm lYFsW6cSkiH1tlu5ja2KP9K5wk1zr2OVVU52g3unJOzD6jCd1u5ak4VI28MHKPu23eGSAqA9yji Zx0zqulkqk/APBDQ6a46u51MMFjtZug== X-Google-Smtp-Source: AGHT+IF9Az/BWQzITjctZ6b6J+3DbL2Au25dNZ5xeR/8UfEPTAmeC648ToclndItx8SfxKw3pk7s3Q== X-Received: by 2002:a05:6000:310e:b0:3a4:f893:3f03 with SMTP id ffacd0b85a97d-3a6d132c97emr3468968f8f.45.1750436561556; Fri, 20 Jun 2025 09:22:41 -0700 (PDT) Received: from ?IPV6:2001:8a0:fac3:6d00:afcc:85d3:71a5:7570? ([2001:8a0:fac3:6d00:afcc:85d3:71a5:7570]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a6d0f18a29sm2511261f8f.36.2025.06.20.09.22.40 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 20 Jun 2025 09:22:40 -0700 (PDT) Message-ID: <4045933d-2307-4c87-9fe8-5c941478510c@palves.net> Date: Fri, 20 Jun 2025 17:22:31 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 2/2] Allow check-mark to be changed for CLI To: gdb-patches@sourceware.org References: <20250509-emoji-check-mark-v1-0-63b6c52411f3@adacore.com> <20250509-emoji-check-mark-v1-2-63b6c52411f3@adacore.com> From: Pedro Alves Content-Language: en-US In-Reply-To: <20250509-emoji-check-mark-v1-2-63b6c52411f3@adacore.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Hi! On 2025-05-09 21:18, Tom Tromey wrote: > In keeping with the emojification of gdb, this patch changes the > default "current" marker to be a check-mark. It adds a knob to allow > the character to be changed, and, as always, reverts to the old output > when emojis are disabled. I think it'd be great if such patches came with some output example in the commit log. For this one, I have to say that I'm surprised that the emoji being proposed as default is a "✓" check mark? That to me would be more appropriate to indicate "completed" or "good" or "enabled". To indicate the selected entry from a list, I think a right arrow, or "👉" (Backhand Index Pointing Right, U+1F449) would make a lot more sense. What's the rationale for going with a check mark? I'd even claim that we shouldn't call this one check-mark, as that would be better used for an emoji truly representing whether something is on/off. Like e.g., I could see us using that in "info breakpoints" output, in the column where we indicate a breakpoint location is enabled or not. And other columns in other tables. I quite like the ongoing emojification, btw! Pedro Alves > --- > gdb/NEWS | 6 ++++++ > gdb/cli-out.c | 8 ++++++++ > gdb/cli-out.h | 2 ++ > gdb/cli/cli-style.c | 32 ++++++++++++++++++++++++++++++++ > gdb/cli/cli-style.h | 3 +++ > gdb/doc/gdb.texinfo | 10 ++++++++++ > gdb/testsuite/gdb.base/style.exp | 4 ++++ > 7 files changed, 65 insertions(+) > > diff --git a/gdb/NEWS b/gdb/NEWS > index a82b7e3342c57b9b066e9012c5a961ad6ba839f0..07e72833a269ffe0ab034d4c4ea8b185ad217983 100644 > --- a/gdb/NEWS > +++ b/gdb/NEWS > @@ -78,6 +78,12 @@ set style error-prefix STRING > with emoji display, and so the prefixes are only displayed if emoji > styling is enabled. > > +set style check-mark STRING > + Set the string that is used to indicate the "current" row when a > + table is printed by the CLI. This functionality is intended for use > + with emoji display, and so the prefixes are only displayed if emoji > + styling is enabled. > + > info linker-namespaces > info linker-namespaces [[N]] > Print information about the given linker namespace (identified as N), > diff --git a/gdb/cli-out.c b/gdb/cli-out.c > index 27a82f607eb3d6abcd9867880e99f824a0392312..c619bb4243dbfe4bdc0fb442e7496aa066b52575 100644 > --- a/gdb/cli-out.c > +++ b/gdb/cli-out.c > @@ -421,6 +421,14 @@ cli_ui_out::do_progress_end () > m_progress_info.pop_back (); > } > > +/* See ui-out.h. */ > + > +const char * > +cli_ui_out::get_check_mark () > +{ > + return ::get_check_mark (); > +} > + > /* local functions */ > > void > diff --git a/gdb/cli-out.h b/gdb/cli-out.h > index c761dacc9a83cf5ffadfca2ee4751a37c2159402..342f2d0a15fb1d3823214d2f946f4ac10ca9346d 100644 > --- a/gdb/cli-out.h > +++ b/gdb/cli-out.h > @@ -81,6 +81,8 @@ class cli_ui_out : public ui_out > double, double) override; > virtual void do_progress_end () override; > > + const char *get_check_mark () override; > + > bool suppress_output () > { return m_suppress_output; } > > diff --git a/gdb/cli/cli-style.c b/gdb/cli/cli-style.c > index e6441277d05f5215ecf3f04a8c82be65d9fd031d..ea56bbccf255b1a11c1ef4b3dfb7e06c5dc9656e 100644 > --- a/gdb/cli/cli-style.c > +++ b/gdb/cli/cli-style.c > @@ -494,6 +494,29 @@ print_error_prefix (ui_file *file) > gdb_puts (error_prefix.c_str (), file); > } > > +/* Emoji check-mark. */ > +static std::string check_mark = "✓"; > + > +/* Implement 'show style check-mark'. */ > + > +static void > +show_check_mark (struct ui_file *file, int from_tty, > + struct cmd_list_element *c, const char *value) > +{ > + gdb_printf (file, _("Check mark is \"%s\".\n"), > + check_mark.c_str ()); > +} > + > +/* See cli-style.h. */ > + > +const char * > +get_check_mark () > +{ > + if (emojis_ok ()) > + return check_mark.c_str (); > + return "*"; > +} > + > void _initialize_cli_style (); > void > _initialize_cli_style () > @@ -737,4 +760,13 @@ The error prefix text is displayed before any error, when\n\ > emoji output is enabled."), > nullptr, show_error_prefix, > &style_set_list, &style_show_list); > + add_setshow_string_cmd ("check-mark", no_class, > + &check_mark, > + _("Set the check mark text."), > + _("Show the check mark text."), > + _("\ > +The check mark text is displayed in a table to indicate which\n\ > +row is currently selected."), > + nullptr, show_check_mark, > + &style_set_list, &style_show_list); > } > diff --git a/gdb/cli/cli-style.h b/gdb/cli/cli-style.h > index b1a950a539cb8eaf5381f3ea546ee9fa3e87500b..7b88424d972303b592149499985e7d868494be03 100644 > --- a/gdb/cli/cli-style.h > +++ b/gdb/cli/cli-style.h > @@ -204,4 +204,7 @@ extern void print_warning_prefix (ui_file *file); > /* Print the error prefix, if desired. */ > extern void print_error_prefix (ui_file *file); > > +/* Return the current check mark string. */ > +extern const char *get_check_mark (); > + > #endif /* GDB_CLI_CLI_STYLE_H */ > diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo > index 5e5e888cf38cea33a9d7b4e77039207374ec2d5e..539b3cba92d6893dcd843f684b00c91037324c0b 100644 > --- a/gdb/doc/gdb.texinfo > +++ b/gdb/doc/gdb.texinfo > @@ -28014,6 +28014,16 @@ emoji display, and so the prefixes are only displayed if emoji styling > is enabled. The defaults are the warning sign emoji for warnings, and > and the cross mark emoji for errors. > > +@item set style check-mark @var{string} > +@itemx show style check-mark > +These commands control the string that the CLI uses to indicate which > +line in a table indicates the current state of @value{GDBN}. For > +example, this would be used to indicate the current thread in the > +output of @samp{info threads}. This functionality is intended for use > +with emoji display, and so the chosen string only displayed if emoji > +styling is enabled. The default is a check box character; with the > +non-emoji fallback being an asterisk. > + > @item set style tui-current-position @samp{on|off} > Enable or disable styling of the source and assembly code highlighted > by the TUI's current position indicator. The default is @samp{off}. > diff --git a/gdb/testsuite/gdb.base/style.exp b/gdb/testsuite/gdb.base/style.exp > index c10be3bc12aa10f5a13856cb14f7fad86f32ff90..9f2a288e953f0711d698673e723d6192c3862d79 100644 > --- a/gdb/testsuite/gdb.base/style.exp > +++ b/gdb/testsuite/gdb.base/style.exp > @@ -341,6 +341,10 @@ proc run_style_tests { } { > gdb_test "maint translate-address" \ > "abcd:requires argument.*" \ > "error prefix" > + > + gdb_test_no_output "set style check-mark @" > + gdb_test "info inferior" "\r\n@ 1 .*" > + gdb_test "show style check-mark" "Check mark is \"@\"\\." > } > } > >