From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id DDUeCQa6JGgjxiIAWB0awg (envelope-from ) for ; Wed, 14 May 2025 11:43:02 -0400 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=gDIexvr2; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 0F34C1E10E; Wed, 14 May 2025 11:43:02 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-10.1 required=5.0 tests=ARC_SIGNED,ARC_VALID, BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU, 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 1F18E1E092 for ; Wed, 14 May 2025 11:43:01 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id CA4F13861034 for ; Wed, 14 May 2025 15:42:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CA4F13861034 Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=gDIexvr2 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTP id 47E103858C2A for ; Wed, 14 May 2025 15:41:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 47E103858C2A Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 47E103858C2A Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1747237317; cv=none; b=aP9rYmcagKilugwcyYHU6wWXb7lprgQGeg+w4tUBVJuiivJynCScp91oRkhFTLzMb12jqzk46CpzAFpCY1ok56oKD25nbjGwNelZLBDmefzZvVEh92uOLwbjEEX3y7JxfF4rlXEW7AE7YF2Rkml+w6VRbmXlcxpqsCP03HO4Dec= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1747237317; c=relaxed/simple; bh=EC1P2ycSshSFmf8C4Vt/v7uG7vzDfcFO1tojtmONx+Y=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=eTMwv1h0mPtnHPjWL24G766Xv9AsPF72iKTtCOboo4VEGnIYGkhvqQ8mlL6xFm4NLjoZvjrxtqDNxIDCN8rJnZxxwN4Tis4gVLrETi2D2QNI8aRfHMEiyyvXLThJ3sdoyo3PtXsxV2PEDyQD+Q6BqLh+a3/u/oGbC6FflVUCzWo= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 47E103858C2A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1747237317; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=jwUDFFrVzDuZwb4Uj5Ia+2HKuqx7g7Qgrh1xaZEcxK0=; b=gDIexvr23j8/lufl0fPfLVkLMVlJkDYAVkJbzgh95PZJsVGVvIYkABNa3bGoKYIwU0xeQK 5bvyxARphAysCIuwqTwUDU088284JvfqjvA6IBIcIrTxauyldzb0OrAjL9+jZGyuPS+dhF KuAyHOPUSQfbmHXpUcoS3LDWM0EkXoY= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-224-WCUwHlKgPuq06VauH_XVYg-1; Wed, 14 May 2025 11:41:55 -0400 X-MC-Unique: WCUwHlKgPuq06VauH_XVYg-1 X-Mimecast-MFC-AGG-ID: WCUwHlKgPuq06VauH_XVYg_1747237314 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-43eea5a5d80so39593555e9.1 for ; Wed, 14 May 2025 08:41:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1747237314; x=1747842114; 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=f4+V+c4Aa4CR6IsWKfgtU6/D4HD3JXUsux7a4RqTzOM=; b=buvy69W7AYFLXEdEZjiRPIBS2rLcHq70eU9jV9HOHNt703/oWVJBMYq/3CxH0oRuDJ jULNDNqZ1r5BT3QrOH6ypQ12UPLwnf+kA6e24Aok392RzlBzoqPUjEQoUzH05IPxtFqQ aRvdYSieRdmDcdJUmyTNH59kB7M9moDrg++rBcv0hmXDHFt/Jne42BZN7diXKqZ4WzRf 9qY8K3h12grn/2x9UdoJtTzUCrQ1Hl9QlgvsIpTyZFmxx88B3QBnSyqwuoaprgdH9ax9 N5w6KaHFXQ9BGiclj0zjwVoNxedHLrYa5OwZdr1uED0gRTZbdI++Nx9KTpS94bv8udzr rh/A== X-Forwarded-Encrypted: i=1; AJvYcCWGj9KtUWxSFVQnfT6x7cBBoQW8o8doS/VPXdJ8u4grCLw4CTZvR7vJOWPrVhixtWd1nBgVQU6BUSRREw==@sourceware.org X-Gm-Message-State: AOJu0YyQ0KogQi8Yr/8Osc8K/cMBdh7U0A0h9F677zpt0SyxX4G8dqKR uogZ6FHzLtixRAoAdrFd55sw3Qhm0HD1D6hQt8hekRwQTL+j/Ncl268LTEkSEdoMassLoW3YGpT 8l9oMAv0O02Y1HZE6WsW9kPxO1y5z0WaNxKC+A+bzncBN8UGGMbgcqeJIfF4BKH92NuI= X-Gm-Gg: ASbGnctjZ/h5bLHoEWd05fceVHamaqeZFtj2v6+H2bSPIRZnQ5Ci9JKxBMmDpamynl+ Nr85/STGmKW2Ab519adQ8uuhryXfbxecOlT2fbJ8nyb/hA/nMfnR+05KufVrzHbUbuLV38p8lHS DtW3/Z/RXGRVgXyjx8SKNFIJc5byBMcf0uUZrzAIWR5QeRJJFU9e4jy9jIR9YjP9sMIFfsKEUf8 XE2CJd4zVCSMs+lgFr4xh3ldx9F9c2OX8ZxfAyTStPqjPIETubCPXZC63+nYtvj/LiW9tky3TAL O+ANSVAsNKMjZy21DjcFKJP4X0UfOv4+AgTu X-Received: by 2002:a05:600c:4f43:b0:43c:ef13:7e5e with SMTP id 5b1f17b1804b1-442f215d914mr34859335e9.26.1747237314031; Wed, 14 May 2025 08:41:54 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHcHAmRNC/2Hw43dnZMlTWk3z85WAw3z2vJovSLxrc9JRGjuP0Qx7hSM8/rRTi61A90CV07Sw== X-Received: by 2002:a05:600c:4f43:b0:43c:ef13:7e5e with SMTP id 5b1f17b1804b1-442f215d914mr34859065e9.26.1747237313592; Wed, 14 May 2025 08:41:53 -0700 (PDT) Received: from localhost (30.226.159.143.dyn.plus.net. [143.159.226.30]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-442f3368fbasm35009335e9.2.2025.05.14.08.41.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 May 2025 08:41:53 -0700 (PDT) From: Andrew Burgess To: Tom Tromey , gdb-patches@sourceware.org Cc: Tom Tromey Subject: Re: [PATCH 2/2] Allow check-mark to be changed for CLI In-Reply-To: <20250509-emoji-check-mark-v1-2-63b6c52411f3@adacore.com> References: <20250509-emoji-check-mark-v1-0-63b6c52411f3@adacore.com> <20250509-emoji-check-mark-v1-2-63b6c52411f3@adacore.com> Date: Wed, 14 May 2025 16:41:52 +0100 Message-ID: <87zfffnqrj.fsf@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: 2tXUM4ytNHCd4RhBVQBVH9fkxTdwlgL8gY2x4v8AArg_1747237314 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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 Tom Tromey writes: > 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 haven't tested this patch just yet (short of time), but I wonder if I set the check-mark character to a multi-character string, does that corrupt the output? I'm guessing so as I don't think table columns auto-adjust. So my real question: at a minimum, should the docs mention that the STRING should only be a single character. And better yet, can we check that the string is only a single character in width somewhere? Thanks, Andrew > --- > 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..07e72833a269ffe0ab034d4c4= ea8b185ad217983 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. > =20 > +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..c619bb4243dbfe4bdc0fb442e= 7496aa066b52575 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 (); > } > =20 > +/* See ui-out.h. */ > + > +const char * > +cli_ui_out::get_check_mark () > +{ > + return ::get_check_mark (); > +} > + > /* local functions */ > =20 > void > diff --git a/gdb/cli-out.h b/gdb/cli-out.h > index c761dacc9a83cf5ffadfca2ee4751a37c2159402..342f2d0a15fb1d3823214d2f9= 46f4ac10ca9346d 100644 > --- a/gdb/cli-out.h > +++ b/gdb/cli-out.h > @@ -81,6 +81,8 @@ class cli_ui_out : public ui_out > =09=09=09=09 double, double) override; > virtual void do_progress_end () override; > =20 > + const char *get_check_mark () override; > + > bool suppress_output () > { return m_suppress_output; } > =20 > diff --git a/gdb/cli/cli-style.c b/gdb/cli/cli-style.c > index e6441277d05f5215ecf3f04a8c82be65d9fd031d..ea56bbccf255b1a11c1ef4b3d= fb7e06c5dc9656e 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); > } > =20 > +/* Emoji check-mark. */ > +static std::string check_mark =3D "=E2=9C=93"; > + > +/* Implement 'show style check-mark'. */ > + > +static void > +show_check_mark (struct ui_file *file, int from_tty, > +=09=09 struct cmd_list_element *c, const char *value) > +{ > + gdb_printf (file, _("Check mark is \"%s\".\n"), > +=09 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."), > =09=09=09 nullptr, show_error_prefix, > =09=09=09 &style_set_list, &style_show_list); > + add_setshow_string_cmd ("check-mark", no_class, > +=09=09=09 &check_mark, > +=09=09=09 _("Set the check mark text."), > +=09=09=09 _("Show the check mark text."), > +=09=09=09 _("\ > +The check mark text is displayed in a table to indicate which\n\ > +row is currently selected."), > +=09=09=09 nullptr, show_check_mark, > +=09=09=09 &style_set_list, &style_show_list); > } > diff --git a/gdb/cli/cli-style.h b/gdb/cli/cli-style.h > index b1a950a539cb8eaf5381f3ea546ee9fa3e87500b..7b88424d972303b5921494999= 85e7d868494be03 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); > =20 > +/* 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..539b3cba92d6893dcd843f684= b00c91037324c0b 100644 > --- a/gdb/doc/gdb.texinfo > +++ b/gdb/doc/gdb.texinfo > @@ -28014,6 +28014,16 @@ emoji display, and so the prefixes are only disp= layed if emoji styling > is enabled. The defaults are the warning sign emoji for warnings, and > and the cross mark emoji for errors. > =20 > +@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/st= yle.exp > index c10be3bc12aa10f5a13856cb14f7fad86f32ff90..9f2a288e953f0711d698673e7= 23d6192c3862d79 100644 > --- a/gdb/testsuite/gdb.base/style.exp > +++ b/gdb/testsuite/gdb.base/style.exp > @@ -341,6 +341,10 @@ proc run_style_tests { } { > =09gdb_test "maint translate-address" \ > =09 "abcd:requires argument.*" \ > =09 "error prefix" > + > +=09gdb_test_no_output "set style check-mark @" > +=09gdb_test "info inferior" "\r\n@ 1 .*" > +=09gdb_test "show style check-mark" "Check mark is \"@\"\\." > } > } > =20 > > --=20 > 2.49.0