Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jan Holesovsky <kendy@suse.cz>
To: gdb-patches@sourceware.org
Subject: Patches to improve the gdbtui user experience
Date: Fri, 14 Sep 2007 11:57:00 -0000	[thread overview]
Message-ID: <200709141358.24710.kendy@suse.cz> (raw)

[-- Attachment #1: Type: text/plain, Size: 948 bytes --]

Hi,

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 ;-)

ChangeLog for the changes:

2007-05-21  Jan Holesovsky  <kendy@suse.cz>

	* tui/tui.c: SingleKey binding for stepi and nexti; 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.
	* tui/tui-win.c: Fix silly typos in help.
	* tui/tui-io.c: Display prompts like ---Type <return>... even in
	  SingleKey mode, and be able to react there.
	* 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.

Thank you a lot in advance!

Regards,
Jan

[-- Attachment #2: better-keys.diff --]
[-- Type: text/x-diff, Size: 955 bytes --]

diff -pur gdb-6.6.orig/gdb/tui/tui.c gdb-6.6/gdb/tui/tui.c
--- gdb-6.6.orig/gdb/tui/tui.c	2005-12-23 11:10:03.000000000 -0800
+++ gdb-6.6/gdb/tui/tui.c	2007-05-16 14:21:11.000000000 -0700
@@ -75,12 +75,14 @@ static const struct tui_char_command tui
   { 'c', "continue" },
   { 'd', "down" },
   { 'f', "finish" },
+  { 'i', "stepi" },
   { 'n', "next" },
   { 'r', "run" },
   { 's', "step" },
   { 'u', "up" },
   { 'v', "info locals" },
   { 'w', "where" },
+  { 'x', "nexti" },
   { 0, 0 },
 };
 
@@ -349,7 +351,6 @@ tui_initialize_readline (void)
   rl_bind_key_in_map ('2', tui_rl_change_windows, tui_ctlx_keymap);
   rl_bind_key_in_map ('o', tui_rl_other_window, emacs_ctlx_keymap);
   rl_bind_key_in_map ('o', tui_rl_other_window, tui_ctlx_keymap);
-  rl_bind_key_in_map ('q', tui_rl_next_keymap, tui_keymap);
   rl_bind_key_in_map ('s', tui_rl_next_keymap, emacs_ctlx_keymap);
   rl_bind_key_in_map ('s', tui_rl_next_keymap, tui_ctlx_keymap);
 }

[-- Attachment #3: fix-help.diff --]
[-- Type: text/x-diff, Size: 666 bytes --]

diff -pur gdb-6.6.orig/gdb/tui/tui-win.c gdb-6.6/gdb/tui/tui-win.c
--- gdb-6.6.orig/gdb/tui/tui-win.c	2006-02-14 11:05:40.000000000 -0800
+++ gdb-6.6/gdb/tui/tui-win.c	2007-05-14 18:51:40.000000000 -0700
@@ -389,10 +389,10 @@ Usage: + [win] [n]\n"));
 Scroll window backward.\n\
 Usage: - [win] [n]\n"));
   add_com ("<", class_tui, tui_scroll_left_command, _("\
-Scroll window forward.\n\
+Scroll window left.\n\
 Usage: < [win] [n]\n"));
   add_com (">", class_tui, tui_scroll_right_command, _("\
-Scroll window backward.\n\
+Scroll window right.\n\
 Usage: > [win] [n]\n"));
   if (xdb_commands)
     add_com ("w", class_xdb, tui_xdb_set_win_height_command, _("\

[-- Attachment #4: single-key-history.diff --]
[-- Type: text/x-diff, Size: 1068 bytes --]

diff -pur gdb-6.6.orig/gdb/tui/tui-command.c gdb-6.6/gdb/tui/tui-command.c
--- gdb-6.6.orig/gdb/tui/tui-command.c	2005-12-23 11:10:02.000000000 -0800
+++ gdb-6.6/gdb/tui/tui-command.c	2007-05-15 14:46:12.000000000 -0700
@@ -32,6 +32,7 @@
 #include "gdb_curses.h"
 #include "gdb_string.h"
 
+#include <readline/readline.h>
 
 /*****************************************
 ** STATIC LOCAL FUNCTIONS FORWARD DECLS    **
@@ -112,11 +113,23 @@ tui_dispatch_ctrl_char (unsigned int ch)
 	  break;
 	case KEY_DOWN:
 	case KEY_SF:
-	  tui_scroll_forward (win_info, 1);
+	  if (tui_current_key_mode == TUI_ONE_COMMAND_MODE)
+	    {
+	      rl_get_next_history (1, 0);
+	      rl_redisplay ();
+	    }
+	  else
+	    tui_scroll_forward (win_info, 1);
 	  break;
 	case KEY_UP:
 	case KEY_SR:
-	  tui_scroll_backward (win_info, 1);
+	  if (tui_current_key_mode == TUI_ONE_COMMAND_MODE)
+	    {
+	      rl_get_previous_history (1, 0);
+	      rl_redisplay ();
+	    }
+	  else
+	    tui_scroll_backward (win_info, 1);
 	  break;
 	case KEY_RIGHT:
 	  tui_scroll_left (win_info, 1);

[-- Attachment #5: fix-prompt.diff --]
[-- Type: text/x-diff, Size: 867 bytes --]

diff -pur gdb-6.6.orig/gdb/tui/tui-io.c gdb-6.6/gdb/tui/tui-io.c
--- gdb-6.6.orig/gdb/tui/tui-io.c	2005-12-23 11:10:02.000000000 -0800
+++ gdb-6.6/gdb/tui/tui-io.c	2007-05-16 07:59:10.000000000 -0700
@@ -211,11 +211,17 @@ tui_redisplay_readline (void)
   if (tui_current_key_mode == TUI_ONE_COMMAND_MODE && rl_end == 0)
     tui_set_key_mode (TUI_SINGLE_KEY_MODE);
 
+  /* Do display prompts like ---Type <return>... even in single command
+     mode, and be able to react on such requests. */
+  prompt = tui_rl_saved_prompt;
   if (tui_current_key_mode == TUI_SINGLE_KEY_MODE)
-    prompt = "";
-  else
-    prompt = tui_rl_saved_prompt;
-  
+    {
+      if (!strcmp (tui_rl_saved_prompt, get_prompt()))
+        prompt = "";
+      else
+        tui_set_key_mode (TUI_ONE_COMMAND_MODE);
+    }
+
   c_pos = -1;
   c_line = -1;
   w = TUI_CMD_WIN->generic.handle;

             reply	other threads:[~2007-09-14 11:57 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-14 11:57 Jan Holesovsky [this message]
2007-09-14 14:25 ` Daniel Jacobowitz
2007-09-15 17:01 ` Pedro Alves
2007-09-15 21:08   ` Pedro Alves

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=200709141358.24710.kendy@suse.cz \
    --to=kendy@suse.cz \
    --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