From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2966 invoked by alias); 14 Sep 2007 11:57:19 -0000 Received: (qmail 2957 invoked by uid 22791); 14 Sep 2007 11:57:18 -0000 X-Spam-Check-By: sourceware.org Received: from styx.suse.cz (HELO mail.suse.cz) (82.119.242.94) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 14 Sep 2007 11:57:13 +0000 Received: from [172.16.241.249] (unknown [85.13.87.242]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.suse.cz (Postfix) with ESMTP id 71E8262828C for ; Fri, 14 Sep 2007 13:57:12 +0200 (CEST) From: Jan Holesovsky To: gdb-patches@sourceware.org Subject: Patches to improve the gdbtui user experience Date: Fri, 14 Sep 2007 11:57:00 -0000 User-Agent: KMail/1.9.6 (enterprise 20070731.694771) MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_gdn6GBPdqb5cSqd" Message-Id: <200709141358.24710.kendy@suse.cz> X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2007-09/txt/msg00176.txt.bz2 --Boundary-00=_gdn6GBPdqb5cSqd Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Content-length: 948 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 * 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 ... 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 --Boundary-00=_gdn6GBPdqb5cSqd Content-Type: text/x-diff; charset="us-ascii"; name="better-keys.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="better-keys.diff" Content-length: 955 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); } --Boundary-00=_gdn6GBPdqb5cSqd Content-Type: text/x-diff; charset="us-ascii"; name="fix-help.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="fix-help.diff" Content-length: 666 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, _("\ --Boundary-00=_gdn6GBPdqb5cSqd Content-Type: text/x-diff; charset="us-ascii"; name="single-key-history.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="single-key-history.diff" Content-length: 1068 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 /***************************************** ** 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); --Boundary-00=_gdn6GBPdqb5cSqd Content-Type: text/x-diff; charset="us-ascii"; name="fix-prompt.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="fix-prompt.diff" Content-length: 867 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 ... 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; --Boundary-00=_gdn6GBPdqb5cSqd--