From 2d8b51cba307333b6a068296d9668cd01164de28 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Tue, 2 Jul 2019 15:43:00 -0600 Subject: [PATCH] Move tui_dispatch_ctrl_char to tui-io.c tui_dispatch_ctrl_char is only called from a single spot in tui-io.c, so move the function to that file and make it static. gdb/ChangeLog 2019-07-17 Tom Tromey * tui/tui-io.c (tui_dispatch_ctrl_char): Move from tui-command.c. Now static. * tui/tui-command.h (tui_dispatch_ctrl_char): Don't declare. * tui/tui-command.c (tui_dispatch_ctrl_char): Move to tui-io.c. --- gdb/ChangeLog | 7 +++++++ gdb/tui/tui-command.c | 51 --------------------------------------------------- gdb/tui/tui-command.h | 2 -- gdb/tui/tui-io.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 58 insertions(+), 53 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 8ccadef..da9015d 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,12 @@ 2019-07-17 Tom Tromey + * tui/tui-io.c (tui_dispatch_ctrl_char): Move from tui-command.c. + Now static. + * tui/tui-command.h (tui_dispatch_ctrl_char): Don't declare. + * tui/tui-command.c (tui_dispatch_ctrl_char): Move to tui-io.c. + +2019-07-17 Tom Tromey + * tui/tui.c: Update. * tui/tui-wingeneral.c (tui_data_window::refresh_window): Move to tui-regs.c. diff --git a/gdb/tui/tui-command.c b/gdb/tui/tui-command.c index bd16f80..1a269e7 100644 --- a/gdb/tui/tui-command.c +++ b/gdb/tui/tui-command.c @@ -37,57 +37,6 @@ ** PUBLIC FUNCTIONS ** ******************************************/ -/* Dispatch the correct tui function based upon the control - character. */ -unsigned int -tui_dispatch_ctrl_char (unsigned int ch) -{ - struct tui_win_info *win_info = tui_win_with_focus (); - - /* Handle the CTRL-L refresh for each window. */ - if (ch == '\f') - tui_refresh_all_win (); - - /* If no window has the focus, or if the focus window can't scroll, - just pass the character through. */ - if (win_info == NULL || !win_info->can_scroll ()) - return ch; - - switch (ch) - { - case KEY_NPAGE: - win_info->forward_scroll (0); - break; - case KEY_PPAGE: - win_info->backward_scroll (0); - break; - case KEY_DOWN: - case KEY_SF: - win_info->forward_scroll (1); - break; - case KEY_UP: - case KEY_SR: - win_info->backward_scroll (1); - break; - case KEY_RIGHT: - win_info->left_scroll (1); - break; - case KEY_LEFT: - win_info->right_scroll (1); - break; - case '\f': - break; - default: - /* We didn't recognize the character as a control character, so pass it - through. */ - return ch; - } - - /* We intercepted the control character, so return 0 (which readline - will interpret as a no-op). */ - return 0; -} - /* See tui-command.h. */ void diff --git a/gdb/tui/tui-command.h b/gdb/tui/tui-command.h index 80f69ca..3f84ee2 100644 --- a/gdb/tui/tui-command.h +++ b/gdb/tui/tui-command.h @@ -22,8 +22,6 @@ #ifndef TUI_TUI_COMMAND_H #define TUI_TUI_COMMAND_H -extern unsigned int tui_dispatch_ctrl_char (unsigned int); - /* Refresh the command window. */ extern void tui_refresh_cmd_win (void); diff --git a/gdb/tui/tui-io.c b/gdb/tui/tui-io.c index cb27306..938f5ab 100644 --- a/gdb/tui/tui-io.c +++ b/gdb/tui/tui-io.c @@ -912,6 +912,57 @@ tui_initialize_io (void) #endif } +/* Dispatch the correct tui function based upon the control + character. */ +static unsigned int +tui_dispatch_ctrl_char (unsigned int ch) +{ + struct tui_win_info *win_info = tui_win_with_focus (); + + /* Handle the CTRL-L refresh for each window. */ + if (ch == '\f') + tui_refresh_all_win (); + + /* If no window has the focus, or if the focus window can't scroll, + just pass the character through. */ + if (win_info == NULL || !win_info->can_scroll ()) + return ch; + + switch (ch) + { + case KEY_NPAGE: + win_info->forward_scroll (0); + break; + case KEY_PPAGE: + win_info->backward_scroll (0); + break; + case KEY_DOWN: + case KEY_SF: + win_info->forward_scroll (1); + break; + case KEY_UP: + case KEY_SR: + win_info->backward_scroll (1); + break; + case KEY_RIGHT: + win_info->left_scroll (1); + break; + case KEY_LEFT: + win_info->right_scroll (1); + break; + case '\f': + break; + default: + /* We didn't recognize the character as a control character, so pass it + through. */ + return ch; + } + + /* We intercepted the control character, so return 0 (which readline + will interpret as a no-op). */ + return 0; +} + /* Get a character from the command window. This is called from the readline package. */ static int -- 2.7.4