Re: Patch 8.2.5084

2022-06-13 Fir de Conversatie James McCoy
On Mon, Jun 13, 2022 at 09:43:20PM +0100, Bram Moolenaar wrote:
> 
> Patch 8.2.5084
> Problem:When the GUI shows a dialog tests get stuck.
> Solution:   Add the --gui-dialog-file argument.
> Files:  runtime/doc/starting.txt, src/Make_mvc.mak, src/gui.c, src/main.c,
> src/message.c, src/os_mswin.c, src/proto/gui.pro,
> src/proto/main.pro, src/structs.h, src/testdir/Make_dos.mak,
> src/testdir/Make_ming.mak, src/testdir/Makefile,
> src/testdir/runtest.vim, src/testdir/shared.vim
> 
> 
> *** ../vim-8.2.5083/runtime/doc/starting.txt  2022-06-04 22:15:48.788982835 
> +0100
> --- runtime/doc/starting.txt  2022-06-13 20:39:37.82648 +0100
> ***
> *** 431,436 
> --- 431,443 
>   Also avoids the "Reading from stdin..." message.
>   Also avoids the "N files to edit" message.
>   
> + --gui-dialog-file {name}*--gui-dialog-file*
> + When using the GUI, instead of showing a dialog, write the
> + title and message of the dialog to file {name}.  The file is
> + careted or appended to.  Only useful for testing, to avoid

s/careted/created/

Cheers,
-- 
James
GPG Key: 4096R/91BF BF4D 6956 BD5D F7B7  2D23 DFE6 91AE 331B A3DB

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20220613232039.yvcmzhebn5bovgn7%40localhost.


Re: Patch 8.2.5084

2022-06-13 Fir de Conversatie Bram Moolenaar


John Marriott wrote:

> On 14-June-2022 06:43, Bram Moolenaar wrote:
> > Patch 8.2.5084
> > Problem:When the GUI shows a dialog tests get stuck.
> > Solution:   Add the --gui-dialog-file argument.
> > Files:  runtime/doc/starting.txt, src/Make_mvc.mak, src/gui.c, 
> > src/main.c,
> >  src/message.c, src/os_mswin.c, src/proto/gui.pro,
> >  src/proto/main.pro, src/structs.h, src/testdir/Make_dos.mak,
> >  src/testdir/Make_ming.mak, src/testdir/Makefile,
> >  src/testdir/runtest.vim, src/testdir/shared.vim
> >
> >
> After this patch mingw64 (gcc 12.1) spits out this warning:
> 
> gcc -c -I. -Iproto -DWIN32 -DWINVER=0x0603 -D_WIN32_WINNT=0x0603 
> -DHAVE_PATHDEF -DFEAT_NORMAL -DHAVE_STDINT_H -D__USE_MINGW_ANSI_STDIO 
> -pipe -march=native -Wall -O3 -fomit-frame-pointer -freg-struct-return 
> -fpie -fPIE -DFEAT_GUI_MSWIN -DFEAT_CLIPBOARD os_mswin.c -o 
> gobjnative/os_mswin.oos_mswin.c: In function 'display_errors':
> 
> os_mswin.c:681:61: warning: pointer targets in passing argument 2 of 
> 'gui_dialog_log' differ in signedness [-Wpointer-sign]
>    681 | if (!gui_dialog_log((char_u *)"Errors", p))
>    | ^
>    | |
>    | char *
> In file included from proto.h:278,
>   from vim.h:2255,
>   from os_mswin.c:16:
> proto/gui.pro:70:43: note: expected 'char_u *' {aka 'unsigned char *'} 
> but argument is of type 'char *'
>     70 | int gui_dialog_log(char_u *title, char_u *message);
>    |   ^~~
> 
> 
> The attached patch tries to fix it.

Thanks.  Can also drop the typecast just below.

-- 
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)

 /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
///  \\\
\\\sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\help me help AIDS victims -- http://ICCF-Holland.org///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20220613213329.3B51F1C06E5%40moolenaar.net.


Re: Patch 8.2.5084

2022-06-13 Fir de Conversatie John Marriott


On 14-June-2022 06:43, Bram Moolenaar wrote:

Patch 8.2.5084
Problem:When the GUI shows a dialog tests get stuck.
Solution:   Add the --gui-dialog-file argument.
Files:  runtime/doc/starting.txt, src/Make_mvc.mak, src/gui.c, src/main.c,
 src/message.c, src/os_mswin.c, src/proto/gui.pro,
 src/proto/main.pro, src/structs.h, src/testdir/Make_dos.mak,
 src/testdir/Make_ming.mak, src/testdir/Makefile,
 src/testdir/runtest.vim, src/testdir/shared.vim



After this patch mingw64 (gcc 12.1) spits out this warning:

gcc -c -I. -Iproto -DWIN32 -DWINVER=0x0603 -D_WIN32_WINNT=0x0603 
-DHAVE_PATHDEF -DFEAT_NORMAL -DHAVE_STDINT_H -D__USE_MINGW_ANSI_STDIO 
-pipe -march=native -Wall -O3 -fomit-frame-pointer -freg-struct-return 
-fpie -fPIE -DFEAT_GUI_MSWIN -DFEAT_CLIPBOARD os_mswin.c -o 
gobjnative/os_mswin.oos_mswin.c: In function 'display_errors':


os_mswin.c:681:61: warning: pointer targets in passing argument 2 of 
'gui_dialog_log' differ in signedness [-Wpointer-sign]

  681 | if (!gui_dialog_log((char_u *)"Errors", p))
  | ^
  | |
  | char *
In file included from proto.h:278,
 from vim.h:2255,
 from os_mswin.c:16:
proto/gui.pro:70:43: note: expected 'char_u *' {aka 'unsigned char *'} 
but argument is of type 'char *'

   70 | int gui_dialog_log(char_u *title, char_u *message);
  |   ^~~


The attached patch tries to fix it.

Cheers
John

--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups "vim_dev" group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/ce924c87-9ed8-9043-fd47-99e896950ac4%40internode.on.net.
--- os_mswin.c.orig 2022-06-14 06:49:16.421594200 +1000
+++ os_mswin.c  2022-06-14 07:02:23.343442700 +1000
@@ -664,7 +664,7 @@
 display_errors(void)
 {
 # ifdef FEAT_GUI
-char *p;
+char_u *p;
 
 #  ifdef VIMDLL
 if (gui.in_use || gui.starting)
@@ -673,7 +673,7 @@
if (error_ga.ga_data != NULL)
{
// avoid putting up a message box with blanks only
-   for (p = (char *)error_ga.ga_data; *p; ++p)
+   for (p = (char_u *)error_ga.ga_data; *p; ++p)
if (!isspace(*p))
{
// Only use a dialog when not using --gui-dialog-file:


Patch 8.2.5084

2022-06-13 Fir de Conversatie Bram Moolenaar


Patch 8.2.5084
Problem:When the GUI shows a dialog tests get stuck.
Solution:   Add the --gui-dialog-file argument.
Files:  runtime/doc/starting.txt, src/Make_mvc.mak, src/gui.c, src/main.c,
src/message.c, src/os_mswin.c, src/proto/gui.pro,
src/proto/main.pro, src/structs.h, src/testdir/Make_dos.mak,
src/testdir/Make_ming.mak, src/testdir/Makefile,
src/testdir/runtest.vim, src/testdir/shared.vim


*** ../vim-8.2.5083/runtime/doc/starting.txt2022-06-04 22:15:48.788982835 
+0100
--- runtime/doc/starting.txt2022-06-13 20:39:37.82648 +0100
***
*** 431,436 
--- 431,443 
Also avoids the "Reading from stdin..." message.
Also avoids the "N files to edit" message.
  
+ --gui-dialog-file {name}  *--gui-dialog-file*
+   When using the GUI, instead of showing a dialog, write the
+   title and message of the dialog to file {name}.  The file is
+   careted or appended to.  Only useful for testing, to avoid
+   that the test gets stuck on a dialog that can't be seen.
+   Without the GUI the argument is ignored.
+ 
*--ttyfail*
  --ttyfail When the stdin or stdout is not a terminal (tty) then exit
right away.
*** ../vim-8.2.5083/src/Make_mvc.mak2022-03-07 15:16:11.461689545 +
--- src/Make_mvc.mak2022-06-13 20:34:40.545159063 +0100
***
*** 1466,1472 
$(MAKE) /NOLOGO -f Make_dos.mak
cd ..
  
! testgvim:
cd testdir
$(MAKE) /NOLOGO -f Make_dos.mak VIMPROG=..\gvim
cd ..
--- 1466,1472 
$(MAKE) /NOLOGO -f Make_dos.mak
cd ..
  
! testgvim testgui:
cd testdir
$(MAKE) /NOLOGO -f Make_dos.mak VIMPROG=..\gvim
cd ..
*** ../vim-8.2.5083/src/gui.c   2022-05-09 20:09:19.286641426 +0100
--- src/gui.c   2022-06-13 21:32:30.249620467 +0100
***
*** 5641,5643 
--- 5641,5666 
  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;
+ }
*** ../vim-8.2.5083/src/main.c  2022-06-04 22:15:48.788982835 +0100
--- src/main.c  2022-06-13 21:28:48.508601625 +0100
***
*** 1025,1030 
--- 1025,1041 
;
  }
  
+ #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 intwas_safe = FALSE;
***
*** 2009,2014 
--- 2020,2026 
// "--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 " execute cmd before vimrc
***
*** 2052,2057 
--- 2064,2075 
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,2453 
--- 2466,2480 
parmp->pre_commands[parmp->n_pre_commands++] =
(char_u *)argv[0];
}
+   // --gui-dialog-file fname
+   if (argv[-1][2]