From 9b8d6827200e1b04d3ca860ce52472655e84248c Mon Sep 17 00:00:00 2001 From: Stephane Carrez Date: Sat, 10 Nov 2012 13:12:18 +0000 Subject: [PATCH] * tui/tui.c (tui_rl_command_key): Switch to TUI_ONE_COMMAND_MODE while executing the gdb command. (tui_rl_startup_hook): Do not switch back to TUI_SINGLE_KEY_MODE if we are called from prompt_for_continue. * tui/tui-io.c (tui_redisplay_readline): Likewise. --- gdb/ChangeLog | 8 ++++++++ gdb/tui/tui-io.c | 7 +++++-- gdb/tui/tui.c | 6 +++++- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index e85145be0b5..b8fc3969c9a 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,11 @@ +2012-11-10 Stephane Carrez + + * tui/tui.c (tui_rl_command_key): Switch to TUI_ONE_COMMAND_MODE + while executing the gdb command. + (tui_rl_startup_hook): Do not switch back to TUI_SINGLE_KEY_MODE if we + are called from prompt_for_continue. + * tui/tui-io.c (tui_redisplay_readline): Likewise. + 2012-11-10 Stephane Carrez PR tui/9584 diff --git a/gdb/tui/tui-io.c b/gdb/tui/tui-io.c index 2fb7bb436c3..29c1a2c6fb5 100644 --- a/gdb/tui/tui-io.c +++ b/gdb/tui/tui-io.c @@ -211,8 +211,11 @@ tui_redisplay_readline (void) /* 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) + mode. The restore must only be done if the command has finished. + The command could call prompt_for_continue and we must not + restore SingleKey so that the prompt and normal keymap are used. */ + if (tui_current_key_mode == TUI_ONE_COMMAND_MODE && rl_end == 0 + && immediate_quit == 0) tui_set_key_mode (TUI_SINGLE_KEY_MODE); if (tui_current_key_mode == TUI_SINGLE_KEY_MODE) diff --git a/gdb/tui/tui.c b/gdb/tui/tui.c index 3e79b322336..feec526b002 100644 --- a/gdb/tui/tui.c +++ b/gdb/tui/tui.c @@ -247,6 +247,10 @@ tui_rl_command_key (int count, int key) in the readline history which turns out to be better. */ rl_insert_text (tui_commands[i].cmd); rl_newline (1, '\n'); + + /* Switch to gdb command mode while executing the command. + This way the gdb's continue prompty will be displayed. */ + tui_set_key_mode (TUI_ONE_COMMAND_MODE); return 0; } } @@ -285,7 +289,7 @@ static int tui_rl_startup_hook (void) { rl_already_prompted = 1; - if (tui_current_key_mode != TUI_COMMAND_MODE) + if (tui_current_key_mode != TUI_COMMAND_MODE && immediate_quit == 0) tui_set_key_mode (TUI_SINGLE_KEY_MODE); tui_redisplay_readline (); return 0; -- 2.30.2