From patchwork Thu Jul 4 17:03:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 33584 Received: (qmail 112912 invoked by alias); 4 Jul 2019 17:04:16 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 107709 invoked by uid 89); 4 Jul 2019 17:03:43 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-19.3 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS autolearn=ham version=3.3.1 spammy=91257 X-HELO: gateway23.websitewelcome.com Received: from gateway23.websitewelcome.com (HELO gateway23.websitewelcome.com) (192.185.49.104) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 04 Jul 2019 17:03:35 +0000 Received: from cm11.websitewelcome.com (cm11.websitewelcome.com [100.42.49.5]) by gateway23.websitewelcome.com (Postfix) with ESMTP id 6C2A2D8D2 for ; Thu, 4 Jul 2019 12:03:34 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id j58whYBgBdnCej58wh6HrP; Thu, 04 Jul 2019 12:03:34 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Sender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=rNQwVNIPWd66PoasEHXRNnAPJB4gnHpwiYdzA5bUxN4=; b=bib7cwh2+JLcoMMuN6O5dDstU1 L2ys7tJ0nivZMef0rtveoYrN/n78oWTVL+Ur5+rUN5pwOdTgA6W57IgyMCR8uaC/UhNic9BLpNDrY tuAkk61mb2mKcgWTVSq7kfs4t; Received: from 174-29-58-150.hlrn.qwest.net ([174.29.58.150]:34704 helo=bapiya.Home) by box5379.bluehost.com with esmtpa (Exim 4.92) (envelope-from ) id 1hj58w-002sNV-3f; Thu, 04 Jul 2019 12:03:34 -0500 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 53/61] Move tui_dispatch_ctrl_char to tui-io.c Date: Thu, 4 Jul 2019 11:03:03 -0600 Message-Id: <20190704170311.15982-54-tom@tromey.com> In-Reply-To: <20190704170311.15982-1-tom@tromey.com> References: <20190704170311.15982-1-tom@tromey.com> 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. 2019-07-04 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/tui/tui-command.c b/gdb/tui/tui-command.c index bd16f801d26..1a269e7fb51 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 80f69caf61b..3f84ee22fa8 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 51f69185da3..70e5310dd13 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