This is the mail archive of the
gdb-cvs@sourceware.org
mailing list for the GDB project.
[binutils-gdb] Update our idea of our terminal's dimensions even outside of TUI
- From: Patrick Palka <ppalka at sourceware dot org>
- To: gdb-cvs at sourceware dot org
- Date: 28 Apr 2015 12:59:09 -0000
- Subject: [binutils-gdb] Update our idea of our terminal's dimensions even outside of TUI
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=a88d0bb33c28bc51c0f53cdd5c42d00217a1d771
commit a88d0bb33c28bc51c0f53cdd5c42d00217a1d771
Author: Patrick Palka <patrick@parcs.ath.cx>
Date: Thu Apr 23 18:36:58 2015 -0400
Update our idea of our terminal's dimensions even outside of TUI
When in the CLI, GDB's "width" and "height" variables are not kept in sync
when the underlying terminal gets resized.
This patch fixes this issue by making sure sure to update GDB's "width"
and "height" variables in the !tui_active case of our SIGWINCH handler.
gdb/ChangeLog:
* tui/tui-win.c (tui_sigwinch_handler): Remove now-stale comment.
(tui_sigwinch_handler): Still update our idea of
the terminal's width and height even when TUI is not active.
Diff:
---
gdb/ChangeLog | 6 ++++++
gdb/tui/tui-win.c | 31 ++++++++++++++++++-------------
2 files changed, 24 insertions(+), 13 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index eadf493..e669e09 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,11 @@
2015-04-28 Patrick Palka <patrick@parcs.ath.cx>
+ * tui/tui-win.c (tui_sigwinch_handler): Remove now-stale comment.
+ (tui_sigwinch_handler): Still update our idea of
+ the terminal's width and height even when TUI is not active.
+
+2015-04-28 Patrick Palka <patrick@parcs.ath.cx>
+
* utils.h (set_screen_width_and_height): Declare.
* utils.c (set_screen_width_and_height): Define.
* tui/tui-win.c (tui_update_gdb_sizes): Use it.
diff --git a/gdb/tui/tui-win.c b/gdb/tui/tui-win.c
index 6830977..683c0ed 100644
--- a/gdb/tui/tui-win.c
+++ b/gdb/tui/tui-win.c
@@ -836,12 +836,6 @@ static struct async_signal_handler *tui_sigwinch_token;
static void
tui_sigwinch_handler (int signal)
{
- /* Set win_resized to TRUE and asynchronously invoke our resize callback. If
- the callback is invoked while TUI is active then it ought to successfully
- resize the screen, resetting win_resized to FALSE. Of course, if the
- callback is invoked while TUI is inactive then it will do nothing; in that
- case, win_resized will remain TRUE until we get a chance to synchronously
- resize the screen from tui_enable(). */
mark_async_signal_handler (tui_sigwinch_token);
tui_set_win_resized_to (TRUE);
}
@@ -850,15 +844,26 @@ tui_sigwinch_handler (int signal)
static void
tui_async_resize_screen (gdb_client_data arg)
{
+ rl_resize_terminal ();
+
if (!tui_active)
- return;
+ {
+ int screen_height, screen_width;
- rl_resize_terminal ();
- tui_resize_all ();
- tui_refresh_all_win ();
- tui_update_gdb_sizes ();
- tui_set_win_resized_to (FALSE);
- tui_redisplay_readline ();
+ rl_get_screen_size (&screen_height, &screen_width);
+ set_screen_width_and_height (screen_width, screen_height);
+
+ /* win_resized is left set so that the next call to tui_enable()
+ resizes the TUI windows. */
+ }
+ else
+ {
+ tui_resize_all ();
+ tui_refresh_all_win ();
+ tui_update_gdb_sizes ();
+ tui_set_win_resized_to (FALSE);
+ tui_redisplay_readline ();
+ }
}
#endif