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]

Re: [readline-mingw] backspace key and TUI size




Daniel Jacobowitz wrote

Regarding the TUI size, the approach seems to be fine, can I send you a new patch whith a ChangeLog for that ?



Yes, please.




Attached is the new proposal with only TUI stuffs.

Denis
Index: terminal.c
===================================================================
--- terminal.c	(revision 264)
+++ terminal.c	(working copy)
@@ -70,6 +70,11 @@
 #include "rlshell.h"
 #include "xmalloc.h"
 
+#if defined (__MINGW32__)
+#  include <windows.h>
+#  include <wincon.h>
+#endif
+
 #define CUSTOM_REDISPLAY_FUNC() (rl_redisplay_function != rl_redisplay)
 #define CUSTOM_INPUT_FUNC() (rl_getc_function != rl_getc)
 
@@ -201,6 +206,20 @@
   struct winsize window_size;
 #endif /* TIOCGWINSZ */
 
+/* For mingw version, we get console size from windows API*/
+#if defined (__MINGW32__)
+  HANDLE hConOut = GetStdHandle(STD_OUTPUT_HANDLE);
+  if ( hConOut != INVALID_HANDLE_VALUE ) 
+    {
+      CONSOLE_SCREEN_BUFFER_INFO scr;  
+      if ( GetConsoleScreenBufferInfo(hConOut, &scr) )
+        {
+          _rl_screenwidth = scr.dwSize.X;
+          _rl_screenheight = scr.srWindow.Bottom - scr.srWindow.Top + 1;
+        }
+    }
+#endif
+
 #if defined (TIOCGWINSZ)
   if (ioctl (tty, TIOCGWINSZ, &window_size) == 0)
     {
2005-02-10  Denis Pilat <denis.pilat@st.com>

	* readline/terminal.c
	(_rl_get_screen_size): we get console size from windows API
	when compiling with minGW. 

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