Move tui_dispatch_ctrl_char to tui-io.c
authorTom Tromey <tom@tromey.com>
Tue, 2 Jul 2019 21:43:00 +0000 (15:43 -0600)
committerTom Tromey <tom@tromey.com>
Wed, 17 Jul 2019 18:19:22 +0000 (12:19 -0600)
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  <tom@tromey.com>

* 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
gdb/tui/tui-command.c
gdb/tui/tui-command.h
gdb/tui/tui-io.c

index 8ccadef28612429ddf1a74da836074fe2c52974b..da9015d5c8c2ad0aebcd6f94df0f25df36a2eddf 100644 (file)
@@ -1,3 +1,10 @@
+2019-07-17  Tom Tromey  <tom@tromey.com>
+
+       * 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  <tom@tromey.com>
 
        * tui/tui.c: Update.
index bd16f801d26d6542ed1e6756f8a3d78c3ab7a254..1a269e7fb519d77143471d7e8cea180a356692b4 100644 (file)
 ** 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
index 80f69caf61bd4a1ae048ad89fb2bbba7a9e83b66..3f84ee22fa80cb6d934fcbcbbeb813c147615643 100644 (file)
@@ -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);
 
index cb2730654874964d1907b923b6bebe6771de8eb4..938f5ab158dbfc6de412f170a3145782d039d19d 100644 (file)
@@ -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