This is the mail archive of the
gdb-cvs@sourceware.org
mailing list for the GDB project.
[binutils-gdb] Fix a pair of screen-resizing issues in TUI
- From: Patrick Palka <ppalka at sourceware dot org>
- To: gdb-cvs at sourceware dot org
- Date: 11 Feb 2015 00:14:22 -0000
- Subject: [binutils-gdb] Fix a pair of screen-resizing issues in TUI
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=fc6b1256ee5062cda1dfdaf2173bee6563eacdb9
commit fc6b1256ee5062cda1dfdaf2173bee6563eacdb9
Author: Patrick Palka <patrick@parcs.ath.cx>
Date: Tue Feb 10 18:45:10 2015 -0500
Fix a pair of screen-resizing issues in TUI
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().
Diff:
---
gdb/ChangeLog | 7 +++++++
gdb/tui/tui-io.c | 1 +
gdb/tui/tui.c | 7 +++++++
3 files changed, 15 insertions(+)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 2a75cea..bdce011 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,12 @@
2015-02-11 Patrick Palka <patrick@parcs.ath.cx>
+ * 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().
+
+2015-02-11 Patrick Palka <patrick@parcs.ath.cx>
+
* tui/tui-io.c (tui_getc): Move cursor to the end of the command
line before printing a newline.
diff --git a/gdb/tui/tui-io.c b/gdb/tui/tui-io.c
index 4083cde..199f331 100644
--- a/gdb/tui/tui-io.c
+++ b/gdb/tui/tui-io.c
@@ -743,6 +743,7 @@ tui_handle_resize_during_io (int original_ch, int for_completion)
{
tui_resize_all ();
tui_refresh_all_win ();
+ tui_update_gdb_sizes ();
tui_set_win_resized_to (FALSE);
if (!for_completion)
{
diff --git a/gdb/tui/tui.c b/gdb/tui/tui.c
index 92463df..834e682 100644
--- a/gdb/tui/tui.c
+++ b/gdb/tui/tui.c
@@ -492,6 +492,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. */