From patchwork Sat Jan 10 03:49:18 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Palka X-Patchwork-Id: 4604 Received: (qmail 23152 invoked by alias); 10 Jan 2015 03:49:37 -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 23131 invoked by uid 89); 10 Jan 2015 03:49:34 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.5 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 X-HELO: mail-qa0-f53.google.com Received: from mail-qa0-f53.google.com (HELO mail-qa0-f53.google.com) (209.85.216.53) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Sat, 10 Jan 2015 03:49:31 +0000 Received: by mail-qa0-f53.google.com with SMTP id n4so1967327qaq.12 for ; Fri, 09 Jan 2015 19:49:29 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=Etp8AA/MEVOlnPf31kPuB4eXeZrtJulO36cUvfoxrQo=; b=X2hByym0UuLS/+M83TLtc6eBUDYoYyObovTuljWC8FDxsW9A8EVHZPyZBjF98Cx+T5 GGwTmymu/+YD73xLK0VwW9naMvKC+I4ylF8t/eyhTuRbHrYMze3WRB9ttKAeUyOCLHDy /FYO2zeMBd5yj+FDHOqtlACVZxVBR/EV1MDwWP59DJ6jQzr9201aNndk67YVoNh5fTAC DPxGqAt+UQkSHGEBhe7kGWeil1Lj6ODGsXgaJsOXTK52UxZNIdQ7C7nxu2ZQ5xRMug5B npnA/k0vb7C6kky859Faueh1MF9Ynbrc2/68SJwfYwT7YpV3ruyuaCm553Bh4XH/Co0H 1BwQ== X-Gm-Message-State: ALoCoQkOsN0Bg2EEdE+TAnRlr3yFw/v98MPoz0MfR2hX2HaGmxJX6YtOYSK5cuC5tzVjP2c7n64u X-Received: by 10.224.79.12 with SMTP id n12mr33413500qak.2.1420861769360; Fri, 09 Jan 2015 19:49:29 -0800 (PST) Received: from localhost.localdomain (ool-4353ac94.dyn.optonline.net. [67.83.172.148]) by mx.google.com with ESMTPSA id y8sm8815554qat.29.2015.01.09.19.49.28 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 09 Jan 2015 19:49:28 -0800 (PST) From: Patrick Palka To: gdb-patches@sourceware.org Cc: Patrick Palka Subject: [PATCH] Fix a pair of screen-resizing issues in TUI Date: Fri, 9 Jan 2015 22:49:18 -0500 Message-Id: <1420861759-10700-1-git-send-email-patrick@parcs.ath.cx> This patch fixes a pair of TUI issues related to screen resizing: 1. In tui_handle_resize_during_io(), when the TUI screen gets resized, we fail to update GDB's idea about the height of the output window. You can see this bug by doing: a. Enter TUI mode. b. "show height" c. Resize the terminal. d. "show height" And observe that despite resizing the terminal, the reported height remains unchanged. Note that a similar issue exists in the CLI. The fix for this is simple: call tui_update_gdb_sizes() after performing a resize, so that the "height" variable remains consistent with the height of TUI's output window. 2. In tui_enable(), the call to tui_update_gdb_sizes() may clobber readline's idea of the actual screen dimensions, and a subsequent pending resize will use bogus terminal dimensions. You can see this bug by doing: a. Enter TUI mode. b. Exit TUI mode. c. Resize the terminal. d. Enter TUI mode. e. Press a key to resize the screen. And observe that the terminal gets incorrectly resized to the wrong dimensions. To fix this issue, we should oppurtunistically resize the screen in tui_enable(). That way we eliminate the possibility of a pending resize triggering right after we call tui_update_gdb_sizes(). gdb/ChangeLog: * tui/tui-io.c (tui_handle_resize_during_io): Call tui_update_gdb_sizes() after resizing the screen. * tui/tui.c (tui_enable): Resize the terminal before calling tui_update_gdb_sizes(). --- gdb/tui/tui-io.c | 1 + gdb/tui/tui.c | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/gdb/tui/tui-io.c b/gdb/tui/tui-io.c index 94c3ec2..fccada5 100644 --- a/gdb/tui/tui-io.c +++ b/gdb/tui/tui-io.c @@ -767,6 +767,7 @@ tui_handle_resize_during_io (void) { tui_resize_all (); tui_refresh_all_win (); + tui_update_gdb_sizes (); tui_set_win_resized_to (FALSE); } } diff --git a/gdb/tui/tui.c b/gdb/tui/tui.c index 00e505d..53eb6d2 100644 --- a/gdb/tui/tui.c +++ b/gdb/tui/tui.c @@ -483,6 +483,13 @@ tui_enable (void) /* Restore TUI keymap. */ tui_set_key_mode (tui_current_key_mode); + + /* Resize and refresh the screen. */ + if (tui_win_resized ()) + { + tui_resize_all (); + tui_set_win_resized_to (FALSE); + } tui_refresh_all_win (); /* Update gdb's knowledge of its terminal. */