[3/3] Reuse "title" style for list headers

Message ID 20241004-cli-command-style-v1-3-cc1fbb3c40bf@tromey.com
State New
Headers
Series Add "command" styling |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 success Build passed
linaro-tcwg-bot/tcwg_gdb_build--master-arm success Build passed
linaro-tcwg-bot/tcwg_gdb_check--master-arm success Test passed
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 success Test passed

Commit Message

Tom Tromey Oct. 4, 2024, 11:31 p.m. UTC
  This patch reuses the "title" style for titles -- in particular the
header line of a list display.
---
 gdb/NEWS                         | 6 ++++++
 gdb/cli-out.c                    | 2 +-
 gdb/doc/gdb.texinfo              | 6 ++----
 gdb/testsuite/gdb.base/style.exp | 3 ++-
 4 files changed, 11 insertions(+), 6 deletions(-)
  

Comments

Eli Zaretskii Oct. 5, 2024, 7:11 a.m. UTC | #1
> From: Tom Tromey <tom@tromey.com>
> Date: Fri, 04 Oct 2024 17:31:43 -0600
> 
> This patch reuses the "title" style for titles -- in particular the
> header line of a list display.
> ---
>  gdb/NEWS                         | 6 ++++++
>  gdb/cli-out.c                    | 2 +-
>  gdb/doc/gdb.texinfo              | 6 ++----
>  gdb/testsuite/gdb.base/style.exp | 3 ++-
>  4 files changed, 11 insertions(+), 6 deletions(-)

Thanks.

> --- a/gdb/NEWS
> +++ b/gdb/NEWS
> @@ -112,6 +112,12 @@ maintenance print remote-registers
>    which registers were included in the last stop reply packet received by
>    GDB.
>  
> +set style title foreground COLOR
> +set style title background COLOR
> +set style title intensity VALUE
> +  This style now applies to the header line of lists.  Previous uses
> +  of this style have been replaced with the new "command" style.

I think this could benefit from a couple of examples of what we mean
by "header line of a list".

> --- a/gdb/doc/gdb.texinfo
> +++ b/gdb/doc/gdb.texinfo
> @@ -27890,10 +27890,8 @@ Files}).
>  @item title
>  Control the styling of titles.  These are managed with the
>  @code{set style title} family of commands.  By default, this style's
> -intensity is bold.  Commands are using the title style to improve
> -the readability of large output.  For example, the commands
> -@command{apropos} and @command{help} are using the title style
> -for the command names.
> +intensity is bold.  The title style is used when displaying the header
> +line of a list.

Likewise here, with cross-references to the respective nodes in the
manual.

The documentation parts are okay with these nits fixed.

Reviewed-By: Eli Zaretskii <eliz@gnu.org>
  

Patch

diff --git a/gdb/NEWS b/gdb/NEWS
index dda4af6f1aedd4b932089a798bd810d8b929e216..d9bce0e811864b4f08120da2731285fec59bff05 100644
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -112,6 +112,12 @@  maintenance print remote-registers
   which registers were included in the last stop reply packet received by
   GDB.
 
+set style title foreground COLOR
+set style title background COLOR
+set style title intensity VALUE
+  This style now applies to the header line of lists.  Previous uses
+  of this style have been replaced with the new "command" style.
+
 * New remote packets
 
 vFile:stat
diff --git a/gdb/cli-out.c b/gdb/cli-out.c
index d8a542d1b9be1416b87754737e8d64cc4dcf9e08..afa73eba2aed645cdae3eee8bedf2da7a2f00edd 100644
--- a/gdb/cli-out.c
+++ b/gdb/cli-out.c
@@ -73,7 +73,7 @@  cli_ui_out::do_table_header (int width, ui_align alignment,
     return;
 
   do_field_string (0, width, alignment, 0, col_hdr.c_str (),
-		   ui_file_style ());
+		   title_style.style ());
 }
 
 /* Mark beginning of a list */
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 679482ccb21e42fb3a9193388deae58d11ee8f4a..9b7c28a1baf783e2cca592a49d9bcb6e229efdc8 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -27890,10 +27890,8 @@  Files}).
 @item title
 Control the styling of titles.  These are managed with the
 @code{set style title} family of commands.  By default, this style's
-intensity is bold.  Commands are using the title style to improve
-the readability of large output.  For example, the commands
-@command{apropos} and @command{help} are using the title style
-for the command names.
+intensity is bold.  The title style is used when displaying the header
+line of a list.
 
 @item highlight
 Control the styling of highlightings.  These are managed with the
diff --git a/gdb/testsuite/gdb.base/style.exp b/gdb/testsuite/gdb.base/style.exp
index 83e0faeebd07428b08ea311b4b6193547dd350a1..628c6b80570882ed5333fe0bab4d117f161f92d0 100644
--- a/gdb/testsuite/gdb.base/style.exp
+++ b/gdb/testsuite/gdb.base/style.exp
@@ -111,7 +111,8 @@  proc run_style_tests { } {
 	    [multi_line \
 		 "#0\\s+$main_expr\\s+\\($arg_expr=$decimal,\\s+$arg_expr=$hex.*\\)\\s+at\\s+$file_expr" \
 		 "$line_expr\\s+.*return.* break here .*"]
-	gdb_test "info breakpoints" "$main_expr at $file_expr.*"
+	gdb_test "info breakpoints" \
+	    ".*[limited_style What title].*$main_expr at $file_expr.*"
 
 	gdb_test_no_output "set style sources off"
 	gdb_test "frame" \