This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[PATCH]: Fix readline keymap when leaving TUI
- From: Stephane Carrez <stcarrez at nerim dot fr>
- To: gdb-patches at sources dot redhat dot com
- Date: Sat, 14 Sep 2002 00:14:15 +0200
- Subject: [PATCH]: Fix readline keymap when leaving TUI
Hi!
I committed this patch (mainline & 5_3) to:
- restore the readline keymap when leaving the TUI
- set back the TUI specific keymap when re-entering (allows to stay in SingleKey mode)
- remove debug printfs when entering/leaving TUI mode
- automatically leave the tui_one_command_mode when the readline buffer becomes
empty (useful if you entered the one-command by error or want to cancel it)
Stephane
2002-09-13 Stephane Carrez <stcarrez@nerim.fr>
* tui.c (tui_rl_switch_mode): Remove unecessary TUI switch printfs.
(tui_initialize_readline): Allow to use space to leave SingleKey
to enter one gdb command.
(tui_enable): Restore the TUI keymap when we are back to TUI.
(tui_disable): Restore normal keymap when leaving TUI.
* tuiIO.c (tui_redisplay_readline): Restore the SingleKey mode
when the buffer becomes empty and we are in tui_one_command_mode.
Index: tui.c
===================================================================
RCS file: /cvs/src/src/gdb/tui/tui.c,v
retrieving revision 1.25
diff -u -p -r1.25 tui.c
--- tui.c 3 Sep 2002 20:47:48 -0000 1.25
+++ tui.c 13 Sep 2002 20:06:25 -0000
@@ -106,14 +106,11 @@ tui_rl_switch_mode (void)
{
tui_disable ();
rl_prep_terminal (0);
-
- printf_filtered ("Left the TUI mode\n");
}
else
{
rl_deprep_terminal ();
tui_enable ();
- printf_filtered ("Entered the TUI mode\n");
}
/* Clear the readline in case switching occurred in middle of something. */
@@ -312,7 +309,7 @@ tui_initialize_readline ()
/* Bind all other keys to tui_rl_command_mode so that we switch
temporarily from SingleKey mode and can enter a gdb command. */
- for (i = ' ' + 1; i < 0x7f; i++)
+ for (i = ' '; i < 0x7f; i++)
{
int j;
@@ -399,6 +396,8 @@ tui_enable (void)
if (selected_frame)
tuiShowFrameInfo (selected_frame);
+ /* Restore TUI keymap. */
+ tui_set_key_mode (tui_current_key_mode);
refresh ();
/* Update gdb's knowledge of its terminal. */
@@ -415,6 +414,9 @@ tui_disable (void)
{
if (!tui_active)
return;
+
+ /* Restore initial readline keymap. */
+ rl_set_keymap (tui_readline_standard_keymap);
/* Remove TUI hooks. */
tui_remove_hooks ();
Index: tuiIO.c
===================================================================
RCS file: /cvs/src/src/gdb/tui/tuiIO.c,v
retrieving revision 1.17
diff -u -p -r1.17 tuiIO.c
--- tuiIO.c 13 Sep 2002 19:47:21 -0000 1.17
+++ tuiIO.c 13 Sep 2002 20:06:25 -0000
@@ -185,7 +185,12 @@ tui_redisplay_readline (void)
WINDOW *w;
char *prompt;
int start_line;
-
+
+ /* Detect when we temporarily left SingleKey and now the readline
+ edit buffer is empty, automatically restore the SingleKey mode. */
+ if (tui_current_key_mode == tui_one_command_mode && rl_end == 0)
+ tui_set_key_mode (tui_single_key_mode);
+
if (tui_current_key_mode == tui_single_key_mode)
prompt = "";
else