]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Rewrite cli-style.c:do_show
authorTom Tromey <tom@tromey.com>
Thu, 11 Dec 2025 22:12:30 +0000 (15:12 -0700)
committerTom Tromey <tom@tromey.com>
Mon, 9 Feb 2026 15:09:10 +0000 (08:09 -0700)
IMO it looks a little nicer if cli-style.c:do_show uses a single
printf to display its output.  This is also slightly more
i18-friendly.

I noticed this while debugging a case where multiple redundant ANSI
escapes were sent.  In conjunction with a subsequent patch, this
approach happens to fix that problem.  FWIW I don't consider such
redundancies to be bugs, but it was convenient to change this one.

Approved-By: Andrew Burgess <aburgess@redhat.com>
gdb/cli/cli-style.c

index 411d8d91347579d8b28d07f25fc094f98f47a11b..ac4fb27e725ba72ec9b758c9d6972da61b5a9bff 100644 (file)
@@ -262,9 +262,8 @@ do_show (const char *what, struct ui_file *file,
         const char *value)
 {
   cli_style_option *cso = (cli_style_option *) cmd->context ();
-  gdb_puts (_("The "), file);
-  fprintf_styled (file, cso->style (), _("\"%s\" style"), cso->name ());
-  gdb_printf (file, _(" %s is: %s\n"), what, value);
+  gdb_printf (file, _("The %p[\"%s\" style%p] %s is: %s\n"),
+             cso->style ().ptr (), cso->name (), nullptr, what, value);
 }
 
 /* See cli-style.h.  */