patch 8.2.5084: when the GUI shows a dialog tests get stuck
Problem: When the GUI shows a dialog tests get stuck.
Solution: Add the --gui-dialog-file argument.
diff --git a/src/main.c b/src/main.c
index b92be4c..3d86796 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1025,6 +1025,17 @@
;
}
+#if defined(FEAT_GUI) || defined(PROTO)
+/*
+ * If a --gui-dialog-file argument was given return the file name.
+ * Otherwise return NULL.
+ */
+ char_u *
+get_gui_dialog_file(void)
+{
+ return params.gui_dialog_file;
+}
+#endif
// When TRUE in a safe state when starting to wait for a character.
static int was_safe = FALSE;
@@ -2009,6 +2020,7 @@
// "--log fname" start logging early
// "--nofork" don't fork
// "--not-a-term" don't warn for not a term
+ // "--gui-dialog-file fname" write dialog text
// "--ttyfail" exit if not a term
// "--noplugin[s]" skip plugins
// "--cmd <cmd>" execute cmd before vimrc
@@ -2052,6 +2064,12 @@
p_lpl = FALSE;
else if (STRNICMP(argv[0] + argv_idx, "not-a-term", 10) == 0)
parmp->not_a_term = TRUE;
+ else if (STRNICMP(argv[0] + argv_idx, "gui-dialog-file", 15)
+ == 0)
+ {
+ want_argument = TRUE;
+ argv_idx += 15;
+ }
else if (STRNICMP(argv[0] + argv_idx, "ttyfail", 7) == 0)
parmp->tty_fail = TRUE;
else if (STRNICMP(argv[0] + argv_idx, "cmd", 3) == 0)
@@ -2448,6 +2466,15 @@
parmp->pre_commands[parmp->n_pre_commands++] =
(char_u *)argv[0];
}
+ // --gui-dialog-file fname
+ if (argv[-1][2] == 'g')
+ {
+ // without GUI ignore the argument
+#ifdef FEAT_GUI
+ parmp->gui_dialog_file = (char_u *)argv[0];
+#endif
+ }
+
// "--startuptime <file>" already handled
// "--log <file>" already handled
break;
@@ -3515,6 +3542,9 @@
#endif
main_msg(_("-T <terminal>\tSet terminal type to <terminal>"));
main_msg(_("--not-a-term\t\tSkip warning for input/output not being a terminal"));
+#ifdef FEAT_GUI
+ main_msg(_("--gui-dialog-file {fname} For testing: write dialog text"));
+#endif
main_msg(_("--ttyfail\t\tExit if input or output is not a terminal"));
main_msg(_("-u <vimrc>\t\tUse <vimrc> instead of any .vimrc"));
#ifdef FEAT_GUI