summaryrefslogtreecommitdiffstats
path: root/src/main.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-06-13 21:42:45 +0100
committerBram Moolenaar <Bram@vim.org>2022-06-13 21:42:45 +0100
commit2d12c25a1b73fb6991006fd970b3132ab8ee8b62 (patch)
tree792f7cec3f4beb90fc67ab120ea87e3155c13686 /src/main.c
parentdb77c49401145d76441fbb3d22a1d7d987681c13 (diff)
patch 8.2.5084: when the GUI shows a dialog tests get stuckv8.2.5084
Problem: When the GUI shows a dialog tests get stuck. Solution: Add the --gui-dialog-file argument.
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/main.c b/src/main.c
index b92be4cfef..3d86796906 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1025,6 +1025,17 @@ is_not_a_term_or_gui()
;
}
+#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 @@ command_line_scan(mparm_T *parmp)
// "--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 @@ command_line_scan(mparm_T *parmp)
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 @@ command_line_scan(mparm_T *parmp)
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 @@ usage(void)
#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