public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] [gdb/tui] Introduce set style tui-border/tui-active-border mode
@ 2023-05-22  8:34 Tom de Vries
  0 siblings, 0 replies; only message in thread
From: Tom de Vries @ 2023-05-22  8:34 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

In https://sourceware.org/pipermail/gdb-patches/2023-May/199735.html it was
mentioned that "set tui" contains the old TUI style system, and that
"set style" is the current one.

Move:
- "set tui border-mode" to "set style tui-border mode", and
- "set tui active-border-mode" to "set style active-tui-border mode"
and keep the old set/show commands as alias.

Tested on x86_64-linux.
---
 gdb/cli/cli-style.h |  7 ++++++
 gdb/doc/gdb.texinfo | 61 ++++++++++++++++++++++++---------------------
 gdb/tui/tui-win.c   | 41 ++++++++++++++++++++++--------
 3 files changed, 70 insertions(+), 39 deletions(-)

diff --git a/gdb/cli/cli-style.h b/gdb/cli/cli-style.h
index f315241ccb4..7f0d5bed0df 100644
--- a/gdb/cli/cli-style.h
+++ b/gdb/cli/cli-style.h
@@ -58,6 +58,13 @@ class cli_style_option
   /* Same as SET_LIST but for the show command list.  */
   struct cmd_list_element *show_list () { return m_show_list; };
 
+  /* Return the 'set style NAME' command list, that can be used
+     to add commands to.  */
+  struct cmd_list_element **modifiable_set_list () { return &m_set_list; };
+
+  /* Same as MODIFIABLE_SET_LIST but for the show command list.  */
+  struct cmd_list_element **modifiable_show_list () { return &m_show_list; };
+
   /* This style can be observed for any changes.  */
   gdb::observers::observable<> changed;
 
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index f23bcc5f3f8..e27790286e4 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -27289,13 +27289,39 @@ for errors and @samp{<optimized-out>} annotations for optimized-out
 values in displaying stack frame information in backtraces
 (@pxref{Backtrace}), etc.
 
+@anchor{tui-border}
 @item tui-border
 Control the styling of the TUI border.  Note that, unlike other
-styling options, only the color of the border can be controlled via
-@code{set style}.  This was done for compatibility reasons, as TUI
-controls to set the border's intensity predated the addition of
-general styling to @value{GDBN}.  @xref{TUI Configuration}.
+styling options, the tui-border has a mode rather than an intensity.
+This was done for compatibility reasons, as TUI controls to set the
+border's intensity predated the addition of general styling to
+@value{GDBN}.  @xref{TUI Configuration}.
 
+The @var{mode} can be one of the following:
+@table @code
+@item normal
+Use normal attributes to display the border.
+
+@item standout
+Use standout mode.
+
+@item reverse
+Use reverse video mode.
+
+@item half
+Use half bright mode.
+
+@item half-standout
+Use half bright and standout mode.
+
+@item bold
+Use extra bright or bold mode.
+
+@item bold-standout
+Use extra bright or bold and standout mode.
+@end table
+
+@anchor{tui-active-border}
 @item tui-active-border
 Control the styling of the active TUI border; that is, the TUI window
 that has the focus.
@@ -30277,30 +30303,9 @@ drawn using character line graphics if the terminal supports them.
 @kindex set tui border-mode
 @itemx set tui active-border-mode @var{mode}
 @kindex set tui active-border-mode
-Select the display attributes for the borders of the inactive windows
-or the active window.  The @var{mode} can be one of the following:
-@table @code
-@item normal
-Use normal attributes to display the border.
-
-@item standout
-Use standout mode.
-
-@item reverse
-Use reverse video mode.
-
-@item half
-Use half bright mode.
-
-@item half-standout
-Use half bright and standout mode.
-
-@item bold
-Use extra bright or bold mode.
-
-@item bold-standout
-Use extra bright or bold and standout mode.
-@end table
+Aliases for @code{set style tui-border mode} and
+@code{set style tui-active-border mode}.  See styles @ref{tui-border}
+and @ref{tui-active-border}.
 
 @item set tui tab-width @var{nchars}
 @kindex set tui tab-width
diff --git a/gdb/tui/tui-win.c b/gdb/tui/tui-win.c
index 6710b3e17e5..edd78a0cd04 100644
--- a/gdb/tui/tui-win.c
+++ b/gdb/tui/tui-win.c
@@ -1219,8 +1219,10 @@ This variable controls the border of TUI windows:\n\
 			show_tui_border_kind,
 			&tui_setlist, &tui_showlist);
 
-  add_setshow_enum_cmd ("border-mode", no_class, tui_border_mode_enums,
-			&tui_border_mode, _("\
+  /* Add set/show style tui-border mode.  */
+  set_show_commands set_show_tui_border_mode
+    = add_setshow_enum_cmd ("mode", no_class, tui_border_mode_enums,
+			    &tui_border_mode, _("\
 Set the attribute mode to use for the TUI window borders."), _("\
 Show the attribute mode to use for the TUI window borders."), _("\
 This variable controls the attributes to use for the window borders:\n\
@@ -1231,12 +1233,22 @@ This variable controls the attributes to use for the window borders:\n\
    half-standout   use half bright and standout mode\n\
    bold            use extra bright or bold\n\
    bold-standout   use extra bright or bold with standout mode"),
-			tui_set_var_cmd,
-			show_tui_border_mode,
-			&tui_setlist, &tui_showlist);
-
-  add_setshow_enum_cmd ("active-border-mode", no_class, tui_border_mode_enums,
-			&tui_active_border_mode, _("\
+			    tui_set_var_cmd,
+			    show_tui_border_mode,
+			    tui_border_style.modifiable_set_list (),
+			    tui_border_style.modifiable_show_list ());
+
+  /* Add set/show tui border-mode aliases.  */
+  add_alias_cmd ("border-mode", set_show_tui_border_mode.set, no_class, 0,
+		 &tui_setlist);
+  add_alias_cmd ("border-mode", set_show_tui_border_mode.show, no_class, 0,
+		 &tui_showlist);
+
+  /* Add set/show style active-tui-border mode.  */
+  set_show_commands set_show_tui_active_border_mode
+    = add_setshow_enum_cmd ("mode", no_class,
+			    tui_border_mode_enums, &tui_active_border_mode,
+			    _("\
 Set the attribute mode to use for the active TUI window border."), _("\
 Show the attribute mode to use for the active TUI window border."), _("\
 This variable controls the attributes to use for the active window border:\n\
@@ -1247,9 +1259,16 @@ This variable controls the attributes to use for the active window border:\n\
    half-standout   use half bright and standout mode\n\
    bold            use extra bright or bold\n\
    bold-standout   use extra bright or bold with standout mode"),
-			tui_set_var_cmd,
-			show_tui_active_border_mode,
-			&tui_setlist, &tui_showlist);
+			    tui_set_var_cmd,
+			    show_tui_active_border_mode,
+			    tui_active_border_style.modifiable_set_list (),
+			    tui_active_border_style.modifiable_show_list ());
+
+  /* Add set/show tui active-border-mode aliases.  */
+  add_alias_cmd ("active-border-mode", set_show_tui_active_border_mode.set,
+		 no_class, 0, &tui_setlist);
+  add_alias_cmd ("active-border-mode", set_show_tui_active_border_mode.show,
+		 no_class, 0, &tui_showlist);
 
   add_setshow_zuinteger_cmd ("tab-width", no_class,
 			     &internal_tab_width, _("\

base-commit: 92172a19f67026b3eb0f9be6762b7a5821abef84
-- 
2.35.3


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-05-22  8:34 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-22  8:34 [PATCH] [gdb/tui] Introduce set style tui-border/tui-active-border mode Tom de Vries

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).