diff src/regexp.c @ 30355:c0be6563fa39 v9.0.0513

patch 9.0.0513: may not be able to use a pattern ad the debug prompt Commit: https://github.com/vim/vim/commit/9781d9c00517a67c44b50b040cca2c5804daf15c Author: Bram Moolenaar <Bram@vim.org> Date: Tue Sep 20 13:51:25 2022 +0100 patch 9.0.0513: may not be able to use a pattern ad the debug prompt Problem: May not be able to use a pattern ad the debug prompt. Solution: Temporarily disable the timeout. (closes https://github.com/vim/vim/issues/11164)
author Bram Moolenaar <Bram@vim.org>
date Tue, 20 Sep 2022 15:00:04 +0200
parents 085406413994
children 37aa9fd2ed72
line wrap: on
line diff
--- a/src/regexp.c
+++ b/src/regexp.c
@@ -80,6 +80,34 @@ disable_regexp_timeout(void)
 }
 #endif
 
+#if defined(FEAT_EVAL) || defined(PROTO)
+# ifdef FEAT_RELTIME
+static sig_atomic_t *saved_timeout_flag;
+# endif
+
+/*
+ * Used at the debug prompt: disable the timeout so that expression evaluation
+ * can used patterns.
+ * Must be followed by calling restore_timeout_for_debugging().
+ */
+    void
+save_timeout_for_debugging(void)
+{
+# ifdef FEAT_RELTIME
+    saved_timeout_flag = (sig_atomic_t *)timeout_flag;
+    timeout_flag = &dummy_timeout_flag;
+# endif
+}
+
+    void
+restore_timeout_for_debugging(void)
+{
+# ifdef FEAT_RELTIME
+    timeout_flag = saved_timeout_flag;
+# endif
+}
+#endif
+
 /*
  * The first byte of the BT regexp internal "program" is actually this magic
  * number; the start node begins in the second byte.  It's used to catch the