From: Stephane Carrez Date: Thu, 24 Jul 2003 20:23:17 +0000 (+0000) Subject: * tui.c (tui_rl_other_window): New function to switch the TUI active X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=3fc14bdbc9bc65cb69892cdde11884d0cb24968b;p=binutils-gdb.git * tui.c (tui_rl_other_window): New function to switch the TUI active window and give focus to a next window. (tui_initialize_readline): Bind it to c-x o. (tui_rl_next_keymap): Activate TUI mode when entering SingleKey mode. --- diff --git a/gdb/tui/ChangeLog b/gdb/tui/ChangeLog index a6574ff69ae..40f4bd2ffb4 100644 --- a/gdb/tui/ChangeLog +++ b/gdb/tui/ChangeLog @@ -1,3 +1,10 @@ +2003-07-24 Stephane Carrez + + * tui.c (tui_rl_other_window): New function to switch the TUI active + window and give focus to a next window. + (tui_initialize_readline): Bind it to c-x o. + (tui_rl_next_keymap): Activate TUI mode when entering SingleKey mode. + 2003-07-23 Stephane Carrez * tui.c (tui_enable): Call tuiRefreshAll to make sure the window diff --git a/gdb/tui/tui.c b/gdb/tui/tui.c index 7efe6585450..601a5795e2d 100644 --- a/gdb/tui/tui.c +++ b/gdb/tui/tui.c @@ -45,6 +45,7 @@ #include "tuiStack.h" #include "tuiWin.h" #include "tuiSourceWin.h" +#include "tuiDataWin.h" #include "readline/readline.h" #include "target.h" #include "frame.h" @@ -209,6 +210,27 @@ tui_rl_delete_other_windows (int notused1, int notused2) return 0; } +/* TUI readline command. + Switch the active window to give the focus to a next window. */ +static int +tui_rl_other_window (int count, int key) +{ + TuiWinInfoPtr winInfo; + + if (!tui_active) + tui_rl_switch_mode (0/*notused*/, 0/*notused*/); + + winInfo = tuiNextWin (tuiWinWithFocus ()); + if (winInfo) + { + tuiSetWinFocusTo (winInfo); + if (dataWin && dataWin->generic.isVisible) + tuiRefreshDataWin (); + keypad (cmdWin->generic.handle, (winInfo != cmdWin)); + } + return 0; +} + /* TUI readline command. Execute the gdb command bound to the specified key. */ static int @@ -248,6 +270,9 @@ tui_rl_command_mode (int count, int key) static int tui_rl_next_keymap (int notused1, int notused2) { + if (!tui_active) + tui_rl_switch_mode (0/*notused*/, 0/*notused*/); + tui_set_key_mode (tui_current_key_mode == tui_command_mode ? tui_single_key_mode : tui_command_mode); return 0; @@ -326,6 +351,8 @@ tui_initialize_readline () rl_bind_key_in_map ('1', tui_rl_delete_other_windows, tui_ctlx_keymap); rl_bind_key_in_map ('2', tui_rl_change_windows, emacs_ctlx_keymap); 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);