This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH]: Fix TUI restoring the height of gdb terminal


Hi!

Committed the following patch on mainline and 6_4 branch to fix the TUI
that failed to restore the correct terminal heigth when leaving the TUI mode.

When you enter in TUI mode (gdb -tui, or CTRL-X CTRL-A), the gdb height is
set to the height of the command window.  When you leave the TUI mode,
the gdb height must be restore to the full screen height.  This was not the
case and the height was still the TUI command window height.

./gdb
(gdb) show height
Number of lines gdb thinks are in a page is 41.
CTRL-X CTRL-A  (ENTER TUI)
(gdb) show height
Number of lines gdb thinks are in a page is 13.
CTRL-X CTRL-A (LEAVE TUI)
(gdb) show height
Number of lines gdb thinks are in a page is 13.


When I wrote this function (2 years ago), I was expecting rl_get_screen_size()
to return the dimension of the window (through TIOCGWINSZ).  But gdb changes
this definition when the "set height" command is called.  By using tui_term_xxx()
we get the real window dimension.

Stephane

2005-11-11  Stephane Carrez  <stcarrez@nerim.fr>

	* tui/tui-win.c (tui_update_gdb_sizes): Use tui_term_width() and
	tui_term_height() to restore the terminal size when leaving the
	TUI mode.
Index: ChangeLog
===================================================================
RCS file: /cvs/src/src/gdb/ChangeLog,v
retrieving revision 1.7401.2.10
diff -u -p -r1.7401.2.10 ChangeLog
--- ChangeLog	11 Nov 2005 10:25:10 -0000	1.7401.2.10
+++ ChangeLog	11 Nov 2005 18:05:04 -0000
@@ -1,5 +1,11 @@
 2005-11-11  Stephane Carrez  <stcarrez@nerim.fr>
 
+	* tui/tui-win.c (tui_update_gdb_sizes): Use tui_term_width() and
+	tui_term_height() to restore the terminal size when leaving the
+	TUI mode.
+
+2005-11-11  Stephane Carrez  <stcarrez@nerim.fr>
+
 	* m68hc11-tdep.c (m68hc11_pseudo_register_write): Use gdb_byte
 	for buffers.
 	(m68hc11_pseudo_register_read): Likewise.
Index: tui/tui-win.c
===================================================================
RCS file: /cvs/src/src/gdb/tui/tui-win.c,v
retrieving revision 1.27
diff -u -p -r1.27 tui-win.c
--- tui/tui-win.c	1 Nov 2005 17:40:25 -0000	1.27
+++ tui/tui-win.c	11 Nov 2005 18:05:05 -0000
@@ -450,15 +450,13 @@ void
 tui_update_gdb_sizes (void)
 {
   char cmd[50];
-  int screenheight, screenwidth;
 
-  rl_get_screen_size (&screenheight, &screenwidth);
   /* Set to TUI command window dimension or use readline values.  */
   sprintf (cmd, "set width %d",
-           tui_active ? TUI_CMD_WIN->generic.width : screenwidth);
+           tui_active ? TUI_CMD_WIN->generic.width : tui_term_width());
   execute_command (cmd, 0);
   sprintf (cmd, "set height %d",
-           tui_active ? TUI_CMD_WIN->generic.height : screenheight);
+           tui_active ? TUI_CMD_WIN->generic.height : tui_term_height());
   execute_command (cmd, 0);
 }
 

Attachment: signature.asc
Description: OpenPGP digital signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]