From: Andrew Burgess <aburgess@redhat.com>
To: gdb-patches@sourceware.org
Cc: Andrew Burgess <aburgess@redhat.com>
Subject: [PATCHv2 01/15] gdb: move some commands into the tui namespace
Date: Sun, 6 Feb 2022 14:12:39 +0000 [thread overview]
Message-ID: <09b6012944b9fbfc03f48131e57030d0c4f029ee.1644156219.git.aburgess@redhat.com> (raw)
In-Reply-To: <cover.1644156219.git.aburgess@redhat.com>
There are a lot of tui related commands that live in the top-level
command name space, e.g. layout, focus, refresh, winheight.
Having them at the top level means less typing for the user, which is
good, but, I think, makes command discovery harder.
In this commit, I propose moving all of the above mentioned commands
into the tui namespace, so 'layout' becomes 'tui layout', etc. But I
will then add aliases so that the old commands will still work,
e.g. I'll make 'layout' an alias for 'tui layout'.
The benefit I see in this work is that tui related commands can be
more easily discovered by typing 'tui ' and then tab-completing. Also
the "official" command is now a tui-sub-command, this is visible in,
for example, the help output, e.g.:
(gdb) help layout
tui layout, layout
Change the layout of windows.
Usage: tui layout prev | next | LAYOUT-NAME
List of tui layout subcommands:
tui layout asm -- Apply the "asm" layout.
tui layout next -- Apply the next TUI layout.
tui layout prev -- Apply the previous TUI layout.
tui layout regs -- Apply the TUI register layout.
tui layout split -- Apply the "split" layout.
tui layout src -- Apply the "src" layout.
Which I think is a good thing, it makes it clearer that this is a tui
command.
I've added a NEWS entry and updated the docs to mention the new and
old command names, with the new name being mentioned first.
---
gdb/NEWS | 15 +++++++++++++++
gdb/doc/gdb.texinfo | 18 +++++++++++++-----
gdb/tui/tui-layout.c | 16 +++++++++++++---
gdb/tui/tui-win.c | 40 ++++++++++++++++++++++++++++++++--------
4 files changed, 73 insertions(+), 16 deletions(-)
diff --git a/gdb/NEWS b/gdb/NEWS
index 8da68c88def..f97f643b6ee 100644
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -81,6 +81,14 @@ maint show gnu-source-highlight enabled
styling to a particular source file, then the Python Pygments
library will be used instead.
+tui layout
+tui focus
+tui refresh
+tui window height
+ These are the new names for the old 'layout', 'focus', 'refresh',
+ and 'winheight' tui commands respectively. The old names still
+ exist as aliases to these new commands.
+
* Changed commands
maint packet
@@ -106,6 +114,13 @@ info win
This command now includes information about the width of the tui
windows in its output.
+layout
+focus
+refresh
+winheight
+ These commands are now aliases for the 'tui layout', 'tui focus',
+ 'tui refresh', and 'tui window height' commands respectively.
+
* Python API
** New function gdb.add_history(), which takes a gdb.Value object
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 2073d929099..4d91741bcbd 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -28866,8 +28866,10 @@
width of the terminal. Because they have weight 2, the source and
assembly windows will be twice the height of the command window.
-@item layout @var{name}
+@kindex tui layout
@kindex layout
+@item tui layout @var{name}
+@itemx layout @var{name}
Changes which TUI windows are displayed. The @var{name} parameter
controls which layout is shown. It can be either one of the built-in
layout names, or the name of a layout defined by the user using
@@ -28897,8 +28899,9 @@
register, assembler, and command windows.
@end table
-@item focus @var{name}
@kindex focus
+@item tui focus @var{name}
+@itemx focus @var{name}
Changes which TUI window is currently active for scrolling. The
@var{name} parameter can be any of the following:
@@ -28922,8 +28925,10 @@
Make the command window active for scrolling.
@end table
-@item refresh
+@kindex tui refresh
@kindex refresh
+@item tui refresh
+@itemx refresh
Refresh the screen. This is similar to typing @kbd{C-L}.
@item tui reg @var{group}
@@ -28959,9 +28964,12 @@
@kindex update
Update the source window and the current execution point.
-@item winheight @var{name} +@var{count}
-@itemx winheight @var{name} -@var{count}
+@kindex tui window height
@kindex winheight
+@item tui window height @var{name} +@var{count}
+@itemx tui window height @var{name} -@var{count}
+@itemx winheight @var{name} +@var{count}
+@itemx winheight @var{name} -@var{count}
Change the height of the window @var{name} by @var{count} lines.
Positive counts increase the height, while negative counts decrease
it. The @var{name} parameter can be the name of any currently visible
diff --git a/gdb/tui/tui-layout.c b/gdb/tui/tui-layout.c
index cef9190c3e1..f8388e3fca5 100644
--- a/gdb/tui/tui-layout.c
+++ b/gdb/tui/tui-layout.c
@@ -839,6 +839,14 @@ destroy_layout (struct cmd_list_element *self, void *context)
static struct cmd_list_element *layout_list;
+/* Called to implement 'tui layout'. */
+
+static void
+tui_layout_command (const char *args, int from_tty)
+{
+ help_list (layout_list, "tui layout ", all_commands, gdb_stdout);
+}
+
/* Add a "layout" command with name NAME that switches to LAYOUT. */
static struct cmd_list_element *
@@ -1017,10 +1025,12 @@ void _initialize_tui_layout ();
void
_initialize_tui_layout ()
{
- add_basic_prefix_cmd ("layout", class_tui, _("\
+ struct cmd_list_element *layout_cmd
+ = add_prefix_cmd ("layout", class_tui, tui_layout_command, _("\
Change the layout of windows.\n\
-Usage: layout prev | next | LAYOUT-NAME"),
- &layout_list, 0, &cmdlist);
+Usage: tui layout prev | next | LAYOUT-NAME"),
+ &layout_list, 0, tui_get_cmd_list ());
+ add_com_alias ("layout", layout_cmd, class_tui, 0);
add_cmd ("next", class_tui, tui_next_layout_command,
_("Apply the next TUI layout."),
diff --git a/gdb/tui/tui-win.c b/gdb/tui/tui-win.c
index fd6ca59a728..ba6aca3d078 100644
--- a/gdb/tui/tui-win.c
+++ b/gdb/tui/tui-win.c
@@ -977,6 +977,18 @@ parse_scrolling_args (const char *arg,
}
}
+/* The list of 'tui window' sub-commands. */
+
+static cmd_list_element *tui_window_cmds = nullptr;
+
+/* Called to implement 'tui window'. */
+
+static void
+tui_window_command (const char *args, int from_tty)
+{
+ help_list (tui_window_cmds, "tui window ", all_commands, gdb_stdout);
+}
+
/* Function to initialize gdb commands, for tui window
manipulation. */
@@ -995,8 +1007,11 @@ _initialize_tui_win ()
&tui_setlist, &tui_showlist,
&setlist, &showlist);
- add_com ("refresh", class_tui, tui_refresh_all_command,
- _("Refresh the terminal display."));
+ cmd_list_element *refresh_cmd
+ = add_cmd ("refresh", class_tui, tui_refresh_all_command,
+ _("Refresh the terminal display."),
+ tui_get_cmd_list ());
+ add_com_alias ("refresh", refresh_cmd, class_tui, 0);
cmd_list_element *tabset_cmd
= add_com ("tabset", class_tui, tui_set_tab_width_command, _("\
@@ -1004,21 +1019,30 @@ Set the width (in characters) of tab stops.\n\
Usage: tabset N"));
deprecate_cmd (tabset_cmd, "set tui tab-width");
+ /* Setup the 'tui window' list of command. */
+ add_prefix_cmd ("window", class_tui, tui_window_command,
+ _("Text User Interface window commands."),
+ &tui_window_cmds, 1, tui_get_cmd_list ());
+
cmd_list_element *winheight_cmd
- = add_com ("winheight", class_tui, tui_set_win_height_command, _("\
+ = add_cmd ("height", class_tui, tui_set_win_height_command, _("\
Set or modify the height of a specified window.\n\
-Usage: winheight WINDOW-NAME [+ | -] NUM-LINES\n\
-Use \"info win\" to see the names of the windows currently being displayed."));
+Usage: tui window height WINDOW-NAME [+ | -] NUM-LINES\n\
+Use \"info win\" to see the names of the windows currently being displayed."),
+ &tui_window_cmds);
+ add_com_alias ("winheight", winheight_cmd, class_tui, 0);
add_com_alias ("wh", winheight_cmd, class_tui, 0);
set_cmd_completer (winheight_cmd, winheight_completer);
add_info ("win", tui_all_windows_info,
_("List of all displayed windows.\n\
Usage: info win"));
cmd_list_element *focus_cmd
- = add_com ("focus", class_tui, tui_set_focus_command, _("\
+ = add_cmd ("focus", class_tui, tui_set_focus_command, _("\
Set focus to named window or next/prev window.\n\
-Usage: focus [WINDOW-NAME | next | prev]\n\
-Use \"info win\" to see the names of the windows currently being displayed."));
+Usage: tui focus [WINDOW-NAME | next | prev]\n\
+Use \"info win\" to see the names of the windows currently being displayed."),
+ tui_get_cmd_list ());
+ add_com_alias ("focus", focus_cmd, class_tui, 0);
add_com_alias ("fs", focus_cmd, class_tui, 0);
set_cmd_completer (focus_cmd, focus_completer);
add_com ("+", class_tui, tui_scroll_forward_command, _("\
--
2.25.4
next prev parent reply other threads:[~2022-02-06 14:13 UTC|newest]
Thread overview: 74+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-28 15:55 [PATCH 0/7] TUI command changes, including new winwidth command Andrew Burgess
2022-01-28 15:55 ` [PATCH 1/7] gdb/tui: add window width information to 'info win' output Andrew Burgess
2022-01-28 17:00 ` Eli Zaretskii
2022-02-06 13:43 ` Andrew Burgess
2022-01-28 15:55 ` [PATCH 2/7] gdb/doc: update docs for 'info win' and 'winheight' commands Andrew Burgess
2022-01-28 17:03 ` Eli Zaretskii
2022-02-06 13:43 ` Andrew Burgess
2022-01-28 15:55 ` [PATCH 3/7] gdb: move some commands into the tui namespace Andrew Burgess
2022-01-28 17:04 ` Eli Zaretskii
2022-01-28 15:55 ` [PATCH 4/7] gdb/tui: rename tui_layout_base::adjust_size to ::set_height Andrew Burgess
2022-01-28 15:55 ` [PATCH 5/7] gdb/tui: rename tui_layout_split:set_weights_from_heights Andrew Burgess
2022-01-28 15:55 ` [PATCH 6/7] gdb/testing/tui: add new functionality to tuiterm.exp Andrew Burgess
2022-01-28 15:55 ` [PATCH 7/7] gdb/tui: add new 'tui window width' command and 'winwidth' alias Andrew Burgess
2022-01-28 17:05 ` Eli Zaretskii
2022-02-06 14:12 ` [PATCHv2 00/15] TUI changes, new winwidth command and resizing changes Andrew Burgess
2022-02-06 14:12 ` Andrew Burgess [this message]
2022-02-06 15:50 ` [PATCHv2 01/15] gdb: move some commands into the tui namespace Eli Zaretskii
2022-02-06 14:12 ` [PATCHv2 02/15] gdb/tui: rename tui_layout_base::adjust_size to ::set_height Andrew Burgess
2022-02-06 14:12 ` [PATCHv2 03/15] gdb/tui: rename tui_layout_split:set_weights_from_heights Andrew Burgess
2022-02-06 14:12 ` [PATCHv2 04/15] gdb/testing/tui: add new functionality to tuiterm.exp Andrew Burgess
2022-03-04 16:29 ` Tom Tromey
2022-02-06 14:12 ` [PATCHv2 05/15] gdb/tui: add new 'tui window width' command and 'winwidth' alias Andrew Burgess
2022-02-06 15:52 ` Eli Zaretskii
2022-02-09 15:33 ` Andrew Burgess
2022-02-09 17:03 ` Eli Zaretskii
2022-03-03 18:52 ` Pedro Alves
2022-02-06 14:12 ` [PATCHv2 06/15] gdb/tui: add a tui debugging flag Andrew Burgess
2022-02-06 15:53 ` Eli Zaretskii
2022-03-04 16:35 ` Tom Tromey
2022-02-06 14:12 ` [PATCHv2 07/15] gdb/tui: add left_boxed_p and right_boxed_p member functions Andrew Burgess
2022-03-04 16:37 ` Tom Tromey
2022-02-06 14:12 ` [PATCHv2 08/15] gdb/tui/testsuite: refactor new-layout.exp test Andrew Burgess
2022-02-06 14:12 ` [PATCHv2 09/15] gdb/tui: avoid fp exception when applying layouts Andrew Burgess
2022-02-06 14:12 ` [PATCHv2 10/15] gdb/tui: fairer distribution of excess space during apply Andrew Burgess
2022-03-04 16:42 ` Tom Tromey
2022-02-06 14:12 ` [PATCHv2 11/15] gdb/tui: allow cmd window to change size in tui_layout_split::apply Andrew Burgess
2022-02-06 14:12 ` [PATCHv2 12/15] gdb/tui: support placing the cmd window into a horizontal layout Andrew Burgess
2022-03-04 17:17 ` Tom Tromey
2022-03-07 20:05 ` Andrew Burgess
2022-03-07 21:24 ` Tom Tromey
2022-02-06 14:12 ` [PATCHv2 13/15] gdb/testsuite: some additional tests in gdb.tui/scroll.exp Andrew Burgess
2022-02-06 14:12 ` [PATCHv2 14/15] gdb/tui: relax restrictions on window max height and width Andrew Burgess
2022-03-04 17:20 ` Tom Tromey
2022-03-07 20:08 ` Andrew Burgess
2022-02-06 14:12 ` [PATCHv2 15/15] gdb/tui: fair split of delta after a resize Andrew Burgess
2022-03-04 17:22 ` Tom Tromey
2022-03-07 22:07 ` Andrew Burgess
2022-03-07 23:42 ` Tom Tromey
2022-02-21 17:29 ` [PATCHv2 00/15] TUI changes, new winwidth command and resizing changes Andrew Burgess
2022-03-02 17:59 ` Andrew Burgess
2022-03-07 22:13 ` [PATCHv3 " Andrew Burgess
2022-03-07 22:13 ` [PATCHv3 01/15] gdb: move some commands into the tui namespace Andrew Burgess
2022-03-07 22:13 ` [PATCHv3 02/15] gdb/tui: rename tui_layout_base::adjust_size to ::set_height Andrew Burgess
2022-03-07 22:13 ` [PATCHv3 03/15] gdb/tui: rename tui_layout_split:set_weights_from_heights Andrew Burgess
2022-03-07 22:13 ` [PATCHv3 04/15] gdb/testing/tui: add new functionality to tuiterm.exp Andrew Burgess
2022-03-07 22:13 ` [PATCHv3 05/15] gdb/tui: add new 'tui window width' command and 'winwidth' alias Andrew Burgess
2022-03-07 22:13 ` [PATCHv3 06/15] gdb/tui: add a tui debugging flag Andrew Burgess
2022-03-08 12:16 ` Eli Zaretskii
2022-03-09 11:48 ` Andrew Burgess
2022-03-09 12:58 ` Eli Zaretskii
2022-03-09 17:53 ` Tom Tromey
2022-03-07 22:13 ` [PATCHv3 07/15] gdb/tui: add left_boxed_p and right_boxed_p member functions Andrew Burgess
2022-03-07 22:13 ` [PATCHv3 08/15] gdb/tui/testsuite: refactor new-layout.exp test Andrew Burgess
2022-03-07 22:13 ` [PATCHv3 09/15] gdb/tui: avoid fp exception when applying layouts Andrew Burgess
2022-03-07 22:13 ` [PATCHv3 10/15] gdb/tui: fairer distribution of excess space during apply Andrew Burgess
2022-03-07 22:13 ` [PATCHv3 11/15] gdb/tui: allow cmd window to change size in tui_layout_split::apply Andrew Burgess
2022-03-07 22:13 ` [PATCHv3 12/15] gdb/tui: support placing the cmd window into a horizontal layout Andrew Burgess
2022-03-07 22:13 ` [PATCHv3 13/15] gdb/testsuite: some additional tests in gdb.tui/scroll.exp Andrew Burgess
2022-03-07 22:13 ` [PATCHv3 14/15] gdb/tui: relax restrictions on window max height and width Andrew Burgess
2022-03-07 22:13 ` [PATCHv3 15/15] gdb/tui: fair split of delta after a resize Andrew Burgess
2022-03-21 17:52 ` [PATCHv3 00/15] TUI changes, new winwidth command and resizing changes Andrew Burgess
2022-03-30 9:13 ` Andrew Burgess
2022-04-03 14:43 ` Andrew Burgess
2022-03-04 17:23 ` [PATCH 0/7] TUI command changes, including new winwidth command Tom Tromey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=09b6012944b9fbfc03f48131e57030d0c4f029ee.1644156219.git.aburgess@redhat.com \
--to=aburgess@redhat.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).