summaryrefslogtreecommitdiffstats
path: root/src/gui.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/gui.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/gui.c')
-rw-r--r--src/gui.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/gui.c b/src/gui.c
index 3b0ebac3f6..68c64d298e 100644
--- a/src/gui.c
+++ b/src/gui.c
@@ -5641,3 +5641,26 @@ check_for_interrupt(int key, int modifiers_arg)
return NUL;
}
+/*
+ * If the "--gui-log-file fname" argument is given write the dialog title and
+ * message to a file and return TRUE. Otherwise return FALSE.
+ * When there is any problem opening the file or writing to the file this is
+ * ignored, showing the dialog might get the test to get stuck.
+ */
+ int
+gui_dialog_log(char_u *title, char_u *message)
+{
+ char_u *fname = get_gui_dialog_file();
+ FILE *fd;
+
+ if (fname == NULL)
+ return FALSE;
+
+ fd = mch_fopen((char *)fname, "a");
+ if (fd != NULL)
+ {
+ fprintf(fd, "%s: %s\n", title, message);
+ fclose(fd);
+ }
+ return TRUE;
+}