This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: Patches to improve the gdbtui user experience
- From: Pedro Alves <pedro_alves at portugalmail dot pt>
- To: Jan Holesovsky <kendy at suse dot cz>
- Cc: gdb-patches at sourceware dot org
- Date: Sat, 15 Sep 2007 18:00:56 +0100
- Subject: Re: Patches to improve the gdbtui user experience
- References: <200709141358.24710.kendy@suse.cz>
Jan Holesovsky wrote:
I've already sent these patches once, but got no response - could you please
have a look, and apply if OK? They are more or less trivial, but especially
the single-key-history.diff and fix-prompt.diff improve the user experience
of single key mode a lot. Comments appreciated ;-)
I use tui mode often, but single key mode, not so often. Anyway, see my
comments below, but note that I can't approve patches.
ChangeLog for the changes:
2007-05-21 Jan Holesovsky <kendy@suse.cz>
* tui/tui.c: SingleKey binding for stepi and nexti;
This seems useful indeed. Thanks!
don't quit
SingleKey by 'q' when it's activated by a nontrivial ctrl+x
> combination - the user is smart enough to exit this mode.
If the only command gdb knows starting with 'q' is "quit", what
is the use? What is it preventing you to type? Maybe
a target/host specific command? At least on cygwin 'q' is not
ambiguous. On the other hand, if you're in in single key mode, and
want to type "quit", you have to type "qquit", since the first 'q' is
eaten, else you'll end up typing "uit" :) I guess it's a matter of
personal taste either way.
* tui/tui-win.c: Fix silly typos in help.
This is trivial indeed.
* tui/tui-io.c: Display prompts like ---Type <return>... even in
SingleKey mode, and be able to react there.
Seems like a hack to me. What about not setting TUI_SINGLE_KEY_MODE
in the first place, if gdb is in the middle of a possibly length
command? The attached works for me, but I didn't regtest it. Is
this usage of immediate_quit ok?
* tui/tui-command.c: When switched temporarily from the SingleKey mode
to command mode, bind [Up] and [Down] keys to readline history; it's
safe because we know that the user wants to type.
In single key mode, I can start to type 'b' for a breakpoint, and
then decide I want to scroll to see at which line I would want to place the
breakpoint at using up/down. If I want access to the history, I can either
use c-p/c-n, or use c-x o to switch focus to the command line, and
then use up/down. With your patch, if I already started typing 'b',
I'll have no way to scroll, other than deleting what I've already
typed, will I?
Cheers,
Pedro Alves
* tui/tui.c (tui_rl_command_mode): Update comment.
(tui_rl_startup_hook): Don't change to single key mode, if
immediate_quit is set.
* tui/tui-io.c (tui_redisplay_readline): Likewise.
---
gdb/tui/tui-io.c | 8 ++++++--
gdb/tui/tui.c | 9 +++++++--
2 files changed, 13 insertions(+), 4 deletions(-)
Index: src/gdb/tui/tui-io.c
===================================================================
--- src.orig/gdb/tui/tui-io.c 2007-09-03 22:27:56.000000000 +0100
+++ src/gdb/tui/tui-io.c 2007-09-15 17:35:18.000000000 +0100
@@ -209,9 +209,13 @@ tui_redisplay_readline (void)
/* Detect when we temporarily left SingleKey and now the readline
edit buffer is empty, automatically restore the SingleKey
- mode. */
+ mode, unless gdb is in the middle of executing a command,
+ possibly expecting user interaction. */
if (tui_current_key_mode == TUI_ONE_COMMAND_MODE && rl_end == 0)
- tui_set_key_mode (TUI_SINGLE_KEY_MODE);
+ {
+ if (!immediate_quit)
+ tui_set_key_mode (TUI_SINGLE_KEY_MODE);
+ }
if (tui_current_key_mode == TUI_SINGLE_KEY_MODE)
prompt = "";
Index: src/gdb/tui/tui.c
===================================================================
--- src.orig/gdb/tui/tui.c 2007-09-03 22:27:58.000000000 +0100
+++ src/gdb/tui/tui.c 2007-09-15 17:33:46.000000000 +0100
@@ -255,7 +255,9 @@ tui_rl_command_key (int count, int key)
/* TUI readline command.
Temporarily leave the TUI SingleKey mode to allow editing
a gdb command with the normal readline. Once the command
- is executed, the TUI SingleKey mode is installed back. */
+ is executed, the TUI SingleKey mode is installed back,
+ unless gdb is in the middle of executing a command, possibly
+ expecting user interaction. */
static int
tui_rl_command_mode (int count, int key)
{
@@ -285,7 +287,10 @@ tui_rl_startup_hook (void)
{
rl_already_prompted = 1;
if (tui_current_key_mode != TUI_COMMAND_MODE)
- tui_set_key_mode (TUI_SINGLE_KEY_MODE);
+ {
+ if (!immediate_quit)
+ tui_set_key_mode (TUI_SINGLE_KEY_MODE);
+ }
tui_redisplay_readline ();
return 0;
}