view src/readline-1-sigwinch.patch @ 6516:5ef7d51c2195

readline: Update to version 8.2-001. * src/readline.mk: Update version and checksum. * src/readline-0-001-upstream.patch: Upstream patch re-formatted to apply in MXE Octave. See: https://ftp.gnu.org/pub/gnu/readline/readline-8.2-patches/readline82-001 * src/readline-0-002-upstream.patch: Remove upstream patch for previous version. * src/readline-1-input.patch, src/readline-1-sigwinch.patch: Update patches. * src/readline-3-fd_set.patch: Add patch to guard functions that use types that aren't available on Windows. * src/gdb-1-readline-8.2.patch: Cherry-pick upstream patch. * dist-files.mk: Update files in list.
author Markus Mützel <markus.muetzel@gmx.de>
date Sat, 12 Nov 2022 17:00:41 +0100
parents 41e50d658de0
children
line wrap: on
line source

diff -ur readline-8.1.2/readline.c readline-8.1.3/readline.c
--- readline-8.1.2/readline.c	2020-12-19 07:55:06.477760951 -0500
+++ readline-8.1.3/readline.c	2020-12-19 07:56:17.722659252 -0500
@@ -1186,8 +1186,13 @@
       RL_SETSTATE(RL_STATE_INITIALIZED);
     }
   else
-    _rl_reset_locale ();	/* check current locale and set locale variables */
+    {
+      _rl_reset_locale ();	/* check current locale and set locale variables */
+#if defined (__MINGW32__)
+      rl_reset_screen_size ();
+#endif      
+    }
 
   /* Initialize the current line information. */
   _rl_init_line_state ();
 
Only in readline-8.1.3: readline.c.orig
diff -ur readline-8.1.2/signals.c readline-8.1.3/signals.c
--- readline-8.1.2/signals.c	2020-12-19 07:55:06.471760622 -0500
+++ readline-8.1.3/signals.c	2020-12-19 08:19:50.548964783 -0500
@@ -46,6 +46,11 @@
 
 #include "rlprivate.h"
 
+#if defined (__MINGW32__)
+#  define WIN32_LEAN_AND_MEAN
+#  include <windows.h>
+#endif
+
 #if defined (HANDLE_SIGNALS)
 
 #if !defined (RETSIGTYPE)
@@ -92,7 +97,7 @@
 int rl_catch_signals = 1;
 
 /* If non-zero, readline will install a signal handler for SIGWINCH. */
-#ifdef SIGWINCH
+#if defined (SIGWINCH) || defined(__MINGW32__)
 int rl_catch_sigwinch = 1;
 #else
 int rl_catch_sigwinch = 0;	/* for the readline state struct in readline.c */
@@ -532,6 +539,21 @@
     }
 #endif /* SIGWINCH */
 
+#if defined (__MINGW32__)
+  if (rl_catch_sigwinch && sigwinch_set_flag == 0)
+    {
+      DWORD mode;
+      HANDLE hStdIn = GetStdHandle (STD_INPUT_HANDLE);
+
+      if (GetConsoleMode (hStdIn, &mode))
+        {
+          mode |= ENABLE_WINDOW_INPUT;
+          if (SetConsoleMode (hStdIn, mode))
+            sigwinch_set_flag = 1;
+        }
+    }
+#endif
+
   return 0;
 }
 
@@ -582,6 +604,20 @@
       sigwinch_set_flag = 0;
     }
 #endif
+#if defined (__MINGW32__)
+  if (rl_catch_sigwinch && sigwinch_set_flag == 1)
+    {
+      DWORD mode;
+      HANDLE hStdIn = GetStdHandle (STD_INPUT_HANDLE);
+
+      if (GetConsoleMode (hStdIn, &mode))
+        {
+          mode &= ~ENABLE_WINDOW_INPUT;
+          if (SetConsoleMode (hStdIn, mode))
+            sigwinch_set_flag = 0;
+        }
+    }
+#endif
 
   return 0;
 }