This is the mail archive of the gdb-patches@sources.redhat.com 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 gdb window size when entering/leaving TUI mode


Hi!

When we enter/leave TUI mode the gdb's lines_per_page is not changed.
This patch fixes that by telling gdb what is the new width/height
of windows when we enter/leave TUI mode.

Committed on mainline.

	Stephane

2002-08-24  Stephane Carrez  <stcarrez@nerim.fr>

	* tuiWin.c (tui_update_gdb_sizes): New function to tell gdb what
	is the size of command window.
	(tuiResizeAll): Call it instead of init_page_info.
	* tui.c (tui_enable): Call it to resize to TUI command window.
	(tui_disable): Likewise for plain screen.

Index: tui.c
===================================================================
RCS file: /cvs/src/src/gdb/tui/tui.c,v
retrieving revision 1.18
diff -u -p -r1.18 tui.c
--- tui.c	24 Aug 2002 15:25:25 -0000	1.18
+++ tui.c	24 Aug 2002 16:25:28 -0000
@@ -262,6 +262,7 @@ tui_enable (void)
   tui_version = 1;
   tui_active = 1;
   refresh ();
+  tui_update_gdb_sizes ();
 }
 
 /* Leave the tui mode.
@@ -286,6 +287,7 @@ tui_disable (void)
 
   tui_version = 0;
   tui_active = 0;
+  tui_update_gdb_sizes ();
 }
 
 /* Wrapper on top of free() to ensure that input address
Index: tuiWin.c
===================================================================
RCS file: /cvs/src/src/gdb/tui/tuiWin.c,v
retrieving revision 1.20
diff -u -p -r1.20 tuiWin.c
--- tuiWin.c	24 Aug 2002 12:28:32 -0000	1.20
+++ tuiWin.c	24 Aug 2002 16:25:29 -0000
@@ -52,6 +52,7 @@
 #include "breakpoint.h"
 #include "frame.h"
 #include "cli/cli-cmds.h"
+#include "top.h"
 
 #include "tui.h"
 #include "tuiData.h"
@@ -64,11 +65,6 @@
 #include "tuiDataWin.h"
 
 /*******************************
-** External Declarations
-********************************/
-extern void init_page_info ();
-
-/*******************************
 ** Static Local Decls
 ********************************/
 static void _makeVisibleWithNewHeight (TuiWinInfoPtr);
@@ -396,6 +392,22 @@ Usage: w <#lines>\n");
   add_show_from_set (c, &tui_showlist);
 }
 
+/* Update gdb's knowledge of the terminal size.  */
+void
+tui_update_gdb_sizes ()
+{
+  char cmd[50];
+  extern int screenheight, screenwidth;		/* in readline */
+
+  /* Set to TUI command window dimension or use readline values.  */
+  sprintf (cmd, "set width %d",
+           tui_active ? cmdWin->generic.width : screenwidth);
+  execute_command (cmd, 0);
+  sprintf (cmd, "set height %d",
+           tui_active ? cmdWin->generic.height : screenheight);
+  execute_command (cmd, 0);
+}
+
 
 /*
    ** tuiSetWinFocusTo
@@ -618,7 +630,7 @@ tuiResizeAll (void)
       /* turn keypad off while we resize */
       if (winWithFocus != cmdWin)
 	keypad (cmdWin->generic.handle, FALSE);
-      init_page_info ();
+      tui_update_gdb_sizes ();
       setTermHeightTo (screenheight);
       setTermWidthTo (screenwidth);
       if (curLayout == SRC_DISASSEM_COMMAND ||
@@ -1039,7 +1051,7 @@ The window name specified must be valid 
 			warning ("Invalid window height specified.\n%s",
 				 WIN_HEIGHT_USAGE);
 		      else
-			init_page_info ();
+                        tui_update_gdb_sizes ();
 		    }
 		  else
 		    warning ("Invalid window height specified.\n%s",

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