vim9script const questions and datastructures

2022-04-03 Fir de Conversatie Ernie Rael

This doesn't produce an error. Should it?

   const c1 = 3
   unlockvar c1

Of course, there is an error on an attempt to modify c1.

I was wondering about const optimizations; figured now's not the time to 
mention it. Then saw that "len('string')" would be done at compile time. 
So here goes.


Is a list a cheap kind of a "C" struct. Define the struct like

   const field1 = 0
   const field2 = 1
   const field3 = 2

and use these consts as list indexes. The struct is adjusted by changing 
the const's.


Using a dict gives the cleanest looking code, and I'd guess the worst 
performance.


Since I haven't looked at the vim9 VM, it may be that PUSHNR/LISTINDEX 
and LOADSCRIPT/LISTINDEX and MEMBER-'foo'/USEDICT are comparable (not 
talking tight loop) and it's purely psychological and I shouldn't use 
disassemble. But the constant value is typically available at compile 
time for LISTINDEX.


Something major I can't answer: are lists arrays or linked? That can 
change the balance towards dict.


-ernie

--
--
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/7c3c6ede-366a-56ab-3409-39ef1381b421%40raelity.com.


Re: Patch 8.2.4670

2022-04-03 Fir de Conversatie Bram Moolenaar


John Marriott wrote:

> > On 03-Apr-2022 20:23, Bram Moolenaar wrote:
> >> Patch 8.2.4670
> >> Problem:=C2=A0=C2=A0=C2=A0 Memory allocation failures for new tab page n=
> ot tested.
> >> Solution:=C2=A0=C2=A0 Add tests with failing memory allocation. (Yegappa=
> n=20
> >> Lakshmanan,
> >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
>  closes #10067)
> >> Files:=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 src/alloc.h, src/blob.c, src/buffer=
> .c, src/window.c,
> >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
>  src/testdir/test_blob.vim, src/testdir/test_buffer.vim,
> >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
>  src/testdir/test_tabpage.vim,=20
> >> src/testdir/test_window_cmd.vim
> >>
> >>
> > After applying patches 8.2.4670 to 8.2.4677, mingw64 (gcc 11.2.0)=20
> > throws this linker error:
> > 
> > gcc -I. -Iproto -DWIN32 -DWINVER=0x0603 -D_WIN32_WINNT=0x0603 

[...]

> > -lcomdlg32 -lcomctl32 -lnetapi32 -lversion -lole32 -luuid
> > d:/users/john/documents/software/mingw/mingw64/bin/../lib/gcc/x86_64-w64-> 
> > mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: 
> > gobjnative/blob.o:blob.c:(.text+0x11): undefined reference to 
> > `alloc_clear_id'
> > d:/users/john/documents/software/mingw/mingw64/bin/../lib/gcc/x86_64-w64-> 
> > mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: 
> > gobjnative/blob.o:blob.c:(.text+0x54): undefined reference to 
> > `alloc_clear_id'
> > d:/users/john/documents/software/mingw/mingw64/bin/../lib/gcc/x86_64-w64-> 
> > mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: 
> > gobjnative/blob.o:blob.c:(.text+0xe1): undefined reference to 
> > `alloc_clear_id'
> > d:/users/john/documents/software/mingw/mingw64/bin/../lib/gcc/x86_64-w64-> 
> > mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: 
> > gobjnative/blob.o:blob.c:(.text+0x4e7): undefined reference to 
> > `alloc_clear_id'
> > d:/users/john/documents/software/mingw/mingw64/bin/../lib/gcc/x86_64-w64-> 
> > mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: 
> > gobjnative/blob.o:blob.c:(.text+0x70b): undefined reference to 
> > `alloc_clear_id'
> > d:/users/john/documents/software/mingw/mingw64/bin/../lib/gcc/x86_64-w64-> 
> > mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: 
> > gobjnative/blob.o:blob.c:(.text+0xa61): more undefined references to 
> > `alloc_clear_id' follow
> > collect2.exe: error: ld returned 1 exit status
> > make: *** [Make_cyg_ming.mak:1107: gvim.exe] Error 2
> > 

Apparently this combination of features is not covered by CI.

> > Sorry I don't have a patch.

Terrible! :-)

> The attached patch seems to fix it.

Ah, there it is.  Thanks.

-- 
BEDEVERE: How do you know so much about swallows?
ARTHUR:   Well you have to know these things when you're a king, you know.
 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// 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/20220403210047.7DFFD1C0561%40moolenaar.net.


Patch 8.2.4681

2022-04-03 Fir de Conversatie Bram Moolenaar


Patch 8.2.4681
Problem:Build fails with a combination of features.
Solution:   Remove #ifdef for alloc_clear_id(). (John Marriott)
Files:  src/alloc.c


*** ../vim-8.2.4680/src/alloc.c 2022-03-19 12:56:42.529503830 +
--- src/alloc.c 2022-04-03 21:56:09.461934100 +0100
***
*** 180,186 
  return p;
  }
  
- #if defined(FEAT_SIGNS) || defined(PROTO)
  /*
   * Same as alloc_clear() but with allocation id for testing
   */
--- 180,185 
***
*** 193,199 
  #endif
  return alloc_clear(size);
  }
- #endif
  
  /*
   * Allocate memory like lalloc() and set all bytes to zero.
--- 192,197 
*** ../vim-8.2.4680/src/version.c   2022-04-03 21:52:47.770067812 +0100
--- src/version.c   2022-04-03 21:57:13.197890354 +0100
***
*** 752,753 
--- 752,755 
  {   /* Add new patch number below this line */
+ /**/
+ 4681,
  /**/

-- 
SIGFUN -- signature too funny (core dumped)

 /// 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/20220403210047.888401C1448%40moolenaar.net.


Re: Patch 8.2.4678

2022-04-03 Fir de Conversatie Bram Moolenaar


John Marriott wrote:

> On 04-Apr-2022 06:12, Bram Moolenaar wrote:
> > Patch 8.2.4678
> > Problem:Vim9: not all code is tested.
> > Solution:   Add a few more tests.
> > Files:  src/vim9execute.c, src/testdir/test_vim9_script.vim,
> >  src/testdir/test_vim9_import.vim, src/testdir/test_vim9_cmd.> 
> > vim
> >
> >
> >
> After this patch, mingw64 (gcc 11.2.0) throws this error:
> 
> 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 vim9execute.c -o 
> gobjnative/vim9execute.o
> In file included from vim9execute.c:15:
> vim9execute.c: In function 'exec_instructions':
> vim9execute.c:2640:37: error: 'e_cant_open_file_str_2' undeclared (first 
> use in this function); did you mean 'e_cant_open_file_str'?
>   2640 |  > Â>    semsg(_(e_cant_open_file_str_2), 
> si->sn_name);
>    |   > Â>  >  ^~
> vim.h:564:25: note: in definition of macro '_'
>    564 | # define _(x) ((char *)(x))
>    |   > Â>   ^
> vim9execute.c:2640:37: note: each undeclared identifier is reported only 
> once for each function it appears in
>   2640 |  > Â>    semsg(_(e_cant_open_file_str_2), 
> si->sn_name);
>    |   > Â>  >  ^~
> vim.h:564:25: note: in definition of macro '_'
>    564 | # define _(x) ((char *)(x))
>    |   > Â>   ^
> make: *** [Make_cyg_ming.mak:1187: gobjnative/vim9execute.o] Error 1
> 
> 
> The attached patch tries to fix it.

I had just sent out a patch to fix this.

> Also, I noticed that two error messages have the same error number in 
> errors.h:

Missing quote?

If it's a very similar error, that would be OK.

-- 
BRIDGEKEEPER: What is the air-speed velocity of an unladen swallow?
ARTHUR:   What do you mean?  An African or European swallow?
BRIDGEKEEPER: Er ...  I don't know that ... Arrggghhh!
   BRIDGEKEEPER is cast into the gorge.
 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// 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/20220403210047.82C9D1C05DA%40moolenaar.net.


Patch 8.2.4680

2022-04-03 Fir de Conversatie Bram Moolenaar


Patch 8.2.4680
Problem:Build failure without +postscript.
Solution:   Use another error message.
Files:  src/vim9execute.c, src/testdir/test_vim9_import.vim


*** ../vim-8.2.4679/src/vim9execute.c   2022-04-03 21:11:31.027579244 +0100
--- src/vim9execute.c   2022-04-03 21:50:37.654148975 +0100
***
*** 2637,2643 
if (do_source(si->sn_name, FALSE, DOSO_NONE, NULL)
   == FAIL)
{
!   semsg(_(e_cant_open_file_str_2), si->sn_name);
goto on_error;
}
}
--- 2637,2643 
if (do_source(si->sn_name, FALSE, DOSO_NONE, NULL)
   == FAIL)
{
!   semsg(_(e_cant_open_file_str), si->sn_name);
goto on_error;
}
}
*** ../vim-8.2.4679/src/testdir/test_vim9_import.vim2022-04-03 
21:11:31.031579240 +0100
--- src/testdir/test_vim9_import.vim2022-04-03 21:51:16.274125418 +0100
***
*** 1001,1007 
delete('XimportRelDel.vim')
DoIt()
END
!   v9.CheckScriptFailure(lines, 'E456:')
  
delete('XimportRel.vim')
delete('XimportRel2.vim')
--- 1001,1007 
delete('XimportRelDel.vim')
DoIt()
END
!   v9.CheckScriptFailure(lines, 'E484:')
  
delete('XimportRel.vim')
delete('XimportRel2.vim')
*** ../vim-8.2.4679/src/version.c   2022-04-03 21:30:25.022559205 +0100
--- src/version.c   2022-04-03 21:52:21.258084725 +0100
***
*** 752,753 
--- 752,755 
  {   /* Add new patch number below this line */
+ /**/
+ 4680,
  /**/

-- 
Q: What kind of stuff do you do?
A: I collect hobbies.

 /// 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/20220403205324.44CD21C0561%40moolenaar.net.


Re: Patch 8.2.4678

2022-04-03 Fir de Conversatie John Marriott


On 04-Apr-2022 06:12, Bram Moolenaar wrote:

Patch 8.2.4678
Problem:Vim9: not all code is tested.
Solution:   Add a few more tests.
Files:  src/vim9execute.c, src/testdir/test_vim9_script.vim,
 src/testdir/test_vim9_import.vim, src/testdir/test_vim9_cmd.vim




After this patch, mingw64 (gcc 11.2.0) throws this error:

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 vim9execute.c -o 
gobjnative/vim9execute.o

In file included from vim9execute.c:15:
vim9execute.c: In function 'exec_instructions':
vim9execute.c:2640:37: error: 'e_cant_open_file_str_2' undeclared (first 
use in this function); did you mean 'e_cant_open_file_str'?
 2640 | semsg(_(e_cant_open_file_str_2), 
si->sn_name);

  | ^~
vim.h:564:25: note: in definition of macro '_'
  564 | # define _(x) ((char *)(x))
  | ^
vim9execute.c:2640:37: note: each undeclared identifier is reported only 
once for each function it appears in
 2640 | semsg(_(e_cant_open_file_str_2), 
si->sn_name);

  | ^~
vim.h:564:25: note: in definition of macro '_'
  564 | # define _(x) ((char *)(x))
  | ^
make: *** [Make_cyg_ming.mak:1187: gobjnative/vim9execute.o] Error 1


The attached patch tries to fix it.

Also, I noticed that two error messages have the same error number in 
errors.h:




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/7060f31a-7608-b503-bd4b-361487bf2494%40internode.on.net.
--- errors.h.orig   2022-04-01 05:46:13.356515400 +1100
+++ errors.h2022-04-04 06:42:25.760817400 +1000
@@ -1123,8 +1123,10 @@
 #ifdef FEAT_POSTSCRIPT
 EXTERN char e_error_writing_to_postscript_output_file[]
INIT(= N_("E455: Error writing to PostScript output file"));
+#endif
 EXTERN char e_cant_open_file_str_2[]
INIT(= N_("E456: Can't open file \"%s\""));
+#ifdef FEAT_POSTSCRIPT
 EXTERN char e_cant_find_postscript_resource_file_str_ps[]
INIT(= N_("E456: Can't find PostScript resource file \"%s.ps\""));
 EXTERN char e_cant_read_postscript_resource_file_str[]


Re: Patch 8.2.4670

2022-04-03 Fir de Conversatie John Marriott


On 04-Apr-2022 06:10, John Marriott wrote:


On 03-Apr-2022 20:23, Bram Moolenaar wrote:

Patch 8.2.4670
Problem:    Memory allocation failures for new tab page not tested.
Solution:   Add tests with failing memory allocation. (Yegappan 
Lakshmanan,

 closes #10067)
Files:  src/alloc.h, src/blob.c, src/buffer.c, src/window.c,
 src/testdir/test_blob.vim, src/testdir/test_buffer.vim,
 src/testdir/test_tabpage.vim, 
src/testdir/test_window_cmd.vim



After applying patches 8.2.4670 to 8.2.4677, mingw64 (gcc 11.2.0) 
throws this linker error:


gcc -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 
-Wl,-nxcompat,-dynamicbase -municode -s -mwindows -o gvim.exe 
gobjnative/alloc.o gobjnative/arabic.o gobjnative/arglist.o 
gobjnative/autocmd.o gobjnative/beval.o gobjnative/blob.o 
gobjnative/blowfish.o gobjnative/buffer.o gobjnative/bufwrite.o 
gobjnative/change.o gobjnative/charset.o gobjnative/cindent.o 
gobjnative/clientserver.o gobjnative/clipboard.o 
gobjnative/cmdexpand.o gobjnative/cmdhist.o gobjnative/crypt.o 
gobjnative/crypt_zip.o gobjnative/debugger.o gobjnative/dict.o 
gobjnative/diff.o gobjnative/digraph.o gobjnative/drawline.o 
gobjnative/drawscreen.o gobjnative/edit.o gobjnative/eval.o 
gobjnative/evalbuffer.o gobjnative/evalfunc.o gobjnative/evalvars.o 
gobjnative/evalwindow.o gobjnative/ex_cmds.o gobjnative/ex_cmds2.o 
gobjnative/ex_docmd.o gobjnative/ex_eval.o gobjnative/ex_getln.o 
gobjnative/fileio.o gobjnative/filepath.o gobjnative/findfile.o 
gobjnative/float.o gobjnative/fold.o gobjnative/getchar.o 
gobjnative/gui_xim.o gobjnative/hardcopy.o gobjnative/hashtab.o 
gobjnative/help.o gobjnative/highlight.o gobjnative/if_cscope.o 
gobjnative/indent.o gobjnative/insexpand.o gobjnative/json.o 
gobjnative/list.o gobjnative/locale.o gobjnative/main.o 
gobjnative/map.o gobjnative/mark.o gobjnative/match.o 
gobjnative/memfile.o gobjnative/memline.o gobjnative/menu.o 
gobjnative/message.o gobjnative/misc1.o gobjnative/misc2.o 
gobjnative/mouse.o gobjnative/move.o gobjnative/mbyte.o 
gobjnative/normal.o gobjnative/ops.o gobjnative/option.o 
gobjnative/optionstr.o gobjnative/os_mswin.o gobjnative/os_win32.o 
gobjnative/pathdef.o gobjnative/popupmenu.o gobjnative/popupwin.o 
gobjnative/profiler.o gobjnative/quickfix.o gobjnative/regexp.o 
gobjnative/register.o gobjnative/scriptfile.o gobjnative/screen.o 
gobjnative/search.o gobjnative/session.o gobjnative/sha256.o 
gobjnative/sign.o gobjnative/spell.o gobjnative/spellfile.o 
gobjnative/spellsuggest.o gobjnative/strings.o gobjnative/syntax.o 
gobjnative/tag.o gobjnative/term.o gobjnative/testing.o 
gobjnative/textformat.o gobjnative/textobject.o gobjnative/textprop.o 
gobjnative/time.o gobjnative/typval.o gobjnative/ui.o 
gobjnative/undo.o gobjnative/usercmd.o gobjnative/userfunc.o 
gobjnative/version.o gobjnative/vim9cmds.o gobjnative/vim9compile.o 
gobjnative/vim9execute.o gobjnative/vim9expr.o gobjnative/vim9instr.o 
gobjnative/vim9script.o gobjnative/vim9type.o gobjnative/viminfo.o 
gobjnative/winclip.o gobjnative/window.o gobjnative/os_w32exe.o 
gobjnative/vimres.o gobjnative/xdiffi.o gobjnative/xemit.o 
gobjnative/xprepare.o gobjnative/xutils.o gobjnative/xhistogram.o 
gobjnative/xpatience.o gobjnative/gui.o gobjnative/gui_w32.o 
gobjnative/gui_beval.o -lkernel32 -luser32 -lgdi32 -ladvapi32 
-lcomdlg32 -lcomctl32 -lnetapi32 -lversion -lole32 -luuid
d:/users/john/documents/software/mingw/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: 
gobjnative/blob.o:blob.c:(.text+0x11): undefined reference to 
`alloc_clear_id'
d:/users/john/documents/software/mingw/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: 
gobjnative/blob.o:blob.c:(.text+0x54): undefined reference to 
`alloc_clear_id'
d:/users/john/documents/software/mingw/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: 
gobjnative/blob.o:blob.c:(.text+0xe1): undefined reference to 
`alloc_clear_id'
d:/users/john/documents/software/mingw/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: 
gobjnative/blob.o:blob.c:(.text+0x4e7): undefined reference to 
`alloc_clear_id'
d:/users/john/documents/software/mingw/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: 
gobjnative/blob.o:blob.c:(.text+0x70b): undefined reference to 
`alloc_clear_id'
d:/users/john/documents/software/mingw/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: 
gobjnative/blob.o:blob.c:(.text+0xa61): more undefined references to 
`alloc_clear_id' follow

collect2.exe: error: ld returned 1 exit status
make: *** [Make_cyg_ming.mak:1107: gvim.exe] Error 2


S

Patch 8.2.4679

2022-04-03 Fir de Conversatie Bram Moolenaar


Patch 8.2.4679
Problem:Cannot have expandcmd() give an error message for mistakes.
Solution:   Add an optional argument to give errors. Fix memory leak when
expanding files fails. (Yegappan Lakshmanan, closes #10071)
Files:  runtime/doc/builtin.txt, src/evalfunc.c, src/filepath.c,
src/testdir/test_expand.vim, src/testdir/test_vim9_builtin.vim


*** ../vim-8.2.4678/runtime/doc/builtin.txt 2022-04-02 21:12:11.006733246 
+0100
--- runtime/doc/builtin.txt 2022-04-03 21:24:27.558903210 +0100
***
*** 161,167 
  exp({expr})   Float   exponential of {expr}
  expand({expr} [, {nosuf} [, {list}]])
any expand special keywords in {expr}
! expandcmd({expr}) String  expand {expr} like with `:edit`
  extend({expr1}, {expr2} [, {expr3}])
List/Dict insert items of {expr2} into {expr1}
  extendnew({expr1}, {expr2} [, {expr3}])
--- 161,168 
  exp({expr})   Float   exponential of {expr}
  expand({expr} [, {nosuf} [, {list}]])
any expand special keywords in {expr}
! expandcmd({string} [, {options}])
!   String  expand {string} like with `:edit`
  extend({expr1}, {expr2} [, {expr3}])
List/Dict insert items of {expr2} into {expr1}
  extendnew({expr1}, {expr2} [, {expr3}])
***
*** 2286,2303 
Can also be used as a |method|: >
Getpattern()->expand()
  
! expandcmd({string})   *expandcmd()*
Expand special items in String {string} like what is done for
an Ex command such as `:edit`.  This expands special keywords,
like with |expand()|, and environment variables, anywhere in
{string}.  "~user" and "~/path" are only expanded at the
start.
Returns the expanded string.  If an error is encountered
during expansion, the unmodified {string} is returned.
Example: >
:echo expandcmd('make %<.o')
! < make /path/runtime/doc/builtin.o ~
! 
Can also be used as a |method|: >
GetCommand()->expandcmd()
  <
--- 2294,2320 
Can also be used as a |method|: >
Getpattern()->expand()
  
! expandcmd({string} [, {options}]) *expandcmd()*
Expand special items in String {string} like what is done for
an Ex command such as `:edit`.  This expands special keywords,
like with |expand()|, and environment variables, anywhere in
{string}.  "~user" and "~/path" are only expanded at the
start.
+ 
+   The following items are supported in the {options} Dict
+   argument:
+   errmsg  If set to TRUE, error messages are displayed
+   if an error is encountered during expansion.
+   By default, error messages are not displayed.
+ 
Returns the expanded string.  If an error is encountered
during expansion, the unmodified {string} is returned.
+ 
Example: >
:echo expandcmd('make %<.o')
!   make /path/runtime/doc/builtin.o
!   :echo expandcmd('make %<.o', {'errmsg': v:true})
! <
Can also be used as a |method|: >
GetCommand()->expandcmd()
  <
*** ../vim-8.2.4678/src/evalfunc.c  2022-04-03 18:01:39.655574461 +0100
--- src/evalfunc.c  2022-04-03 21:24:27.558903210 +0100
***
*** 1761,1767 
ret_float,  FLOAT_FUNC(f_exp)},
  {"expand",1, 3, FEARG_1,  arg3_string_bool_bool,
ret_any,f_expand},
! {"expandcmd", 1, 1, FEARG_1,  arg1_string,
ret_string, f_expandcmd},
  {"extend",2, 3, FEARG_1,  arg23_extend,
ret_extend, f_extend},
--- 1761,1767 
ret_float,  FLOAT_FUNC(f_exp)},
  {"expand",1, 3, FEARG_1,  arg3_string_bool_bool,
ret_any,f_expand},
! {"expandcmd", 1, 2, FEARG_1,  arg2_string_dict,
ret_string, f_expandcmd},
  {"extend",2, 3, FEARG_1,  arg23_extend,
ret_extend, f_extend},
***
*** 4152,4161 
  exarg_T   eap;
  char_u*cmdstr;
  char  *errormsg = NULL;
  
! if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL)
return;
  
  rettv->v_type = VAR_STRING;
  cmdstr = vim_

Re: Patch 8.2.4670

2022-04-03 Fir de Conversatie John Marriott



On 03-Apr-2022 20:23, Bram Moolenaar wrote:

Patch 8.2.4670
Problem:Memory allocation failures for new tab page not tested.
Solution:   Add tests with failing memory allocation. (Yegappan Lakshmanan,
 closes #10067)
Files:  src/alloc.h, src/blob.c, src/buffer.c, src/window.c,
 src/testdir/test_blob.vim, src/testdir/test_buffer.vim,
 src/testdir/test_tabpage.vim, src/testdir/test_window_cmd.vim


After applying patches 8.2.4670 to 8.2.4677, mingw64 (gcc 11.2.0) throws 
this linker error:


gcc -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 -Wl,-nxcompat,-dynamicbase 
-municode -s -mwindows -o gvim.exe gobjnative/alloc.o 
gobjnative/arabic.o gobjnative/arglist.o gobjnative/autocmd.o 
gobjnative/beval.o gobjnative/blob.o gobjnative/blowfish.o 
gobjnative/buffer.o gobjnative/bufwrite.o gobjnative/change.o 
gobjnative/charset.o gobjnative/cindent.o gobjnative/clientserver.o 
gobjnative/clipboard.o gobjnative/cmdexpand.o gobjnative/cmdhist.o 
gobjnative/crypt.o gobjnative/crypt_zip.o gobjnative/debugger.o 
gobjnative/dict.o gobjnative/diff.o gobjnative/digraph.o 
gobjnative/drawline.o gobjnative/drawscreen.o gobjnative/edit.o 
gobjnative/eval.o gobjnative/evalbuffer.o gobjnative/evalfunc.o 
gobjnative/evalvars.o gobjnative/evalwindow.o gobjnative/ex_cmds.o 
gobjnative/ex_cmds2.o gobjnative/ex_docmd.o gobjnative/ex_eval.o 
gobjnative/ex_getln.o gobjnative/fileio.o gobjnative/filepath.o 
gobjnative/findfile.o gobjnative/float.o gobjnative/fold.o 
gobjnative/getchar.o gobjnative/gui_xim.o gobjnative/hardcopy.o 
gobjnative/hashtab.o gobjnative/help.o gobjnative/highlight.o 
gobjnative/if_cscope.o gobjnative/indent.o gobjnative/insexpand.o 
gobjnative/json.o gobjnative/list.o gobjnative/locale.o 
gobjnative/main.o gobjnative/map.o gobjnative/mark.o gobjnative/match.o 
gobjnative/memfile.o gobjnative/memline.o gobjnative/menu.o 
gobjnative/message.o gobjnative/misc1.o gobjnative/misc2.o 
gobjnative/mouse.o gobjnative/move.o gobjnative/mbyte.o 
gobjnative/normal.o gobjnative/ops.o gobjnative/option.o 
gobjnative/optionstr.o gobjnative/os_mswin.o gobjnative/os_win32.o 
gobjnative/pathdef.o gobjnative/popupmenu.o gobjnative/popupwin.o 
gobjnative/profiler.o gobjnative/quickfix.o gobjnative/regexp.o 
gobjnative/register.o gobjnative/scriptfile.o gobjnative/screen.o 
gobjnative/search.o gobjnative/session.o gobjnative/sha256.o 
gobjnative/sign.o gobjnative/spell.o gobjnative/spellfile.o 
gobjnative/spellsuggest.o gobjnative/strings.o gobjnative/syntax.o 
gobjnative/tag.o gobjnative/term.o gobjnative/testing.o 
gobjnative/textformat.o gobjnative/textobject.o gobjnative/textprop.o 
gobjnative/time.o gobjnative/typval.o gobjnative/ui.o gobjnative/undo.o 
gobjnative/usercmd.o gobjnative/userfunc.o gobjnative/version.o 
gobjnative/vim9cmds.o gobjnative/vim9compile.o gobjnative/vim9execute.o 
gobjnative/vim9expr.o gobjnative/vim9instr.o gobjnative/vim9script.o 
gobjnative/vim9type.o gobjnative/viminfo.o gobjnative/winclip.o 
gobjnative/window.o gobjnative/os_w32exe.o gobjnative/vimres.o 
gobjnative/xdiffi.o gobjnative/xemit.o gobjnative/xprepare.o 
gobjnative/xutils.o gobjnative/xhistogram.o gobjnative/xpatience.o 
gobjnative/gui.o gobjnative/gui_w32.o gobjnative/gui_beval.o -lkernel32 
-luser32 -lgdi32 -ladvapi32 -lcomdlg32 -lcomctl32 -lnetapi32 -lversion 
-lole32 -luuid
d:/users/john/documents/software/mingw/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: 
gobjnative/blob.o:blob.c:(.text+0x11): undefined reference to 
`alloc_clear_id'
d:/users/john/documents/software/mingw/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: 
gobjnative/blob.o:blob.c:(.text+0x54): undefined reference to 
`alloc_clear_id'
d:/users/john/documents/software/mingw/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: 
gobjnative/blob.o:blob.c:(.text+0xe1): undefined reference to 
`alloc_clear_id'
d:/users/john/documents/software/mingw/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: 
gobjnative/blob.o:blob.c:(.text+0x4e7): undefined reference to 
`alloc_clear_id'
d:/users/john/documents/software/mingw/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: 
gobjnative/blob.o:blob.c:(.text+0x70b): undefined reference to 
`alloc_clear_id'
d:/users/john/documents/software/mingw/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: 
gobjnative/blob.o:blob.c:(.text+0xa61): more undefined references to 
`alloc_clear_id' follow

collect2.exe: error: ld returned 1 exit status
make: *** [Make_cyg_ming.mak:1107: gvim.exe] Error 2


Sorry I don't have a patch.

Cheers
John

--
--
Yo

Patch 8.2.4678

2022-04-03 Fir de Conversatie Bram Moolenaar


Patch 8.2.4678
Problem:Vim9: not all code is tested.
Solution:   Add a few more tests.
Files:  src/vim9execute.c, src/testdir/test_vim9_script.vim,
src/testdir/test_vim9_import.vim, src/testdir/test_vim9_cmd.vim


*** ../vim-8.2.4677/src/vim9execute.c   2022-04-01 15:26:54.988558723 +0100
--- src/vim9execute.c   2022-04-03 19:46:09.277664634 +0100
***
*** 2636,2642 
--- 2636,2645 
SOURCING_LNUM = iptr->isn_lnum;
if (do_source(si->sn_name, FALSE, DOSO_NONE, NULL)
   == FAIL)
+   {
+   semsg(_(e_cant_open_file_str_2), si->sn_name);
goto on_error;
+   }
}
}
break;
*** ../vim-8.2.4677/src/testdir/test_vim9_script.vim2022-04-03 
16:13:03.420370565 +0100
--- src/testdir/test_vim9_script.vim2022-04-03 21:10:45.923612372 +0100
***
*** 2130,2135 
--- 2130,2146 
endfor
assert_equal('', res)
  
+   total = 0
+   for c in null_list
+ total += 1
+   endfor
+   assert_equal(0, total)
+ 
+   for c in null_blob
+ total += 1
+   endfor
+   assert_equal(0, total)
+ 
var foo: list> = [
{a: 'Cat'}
  ]
*** ../vim-8.2.4677/src/testdir/test_vim9_import.vim2022-03-31 
16:18:19.916278625 +0100
--- src/testdir/test_vim9_import.vim2022-04-03 20:26:55.879006212 +0100
***
*** 858,863 
--- 858,865 
writefile(lines, 'XimportRel.vim')
writefile(lines, 'XimportRel2.vim')
writefile(lines, 'XimportRel3.vim')
+   writefile(lines, 'XimportRel4.vim')
+   writefile(lines, 'XimportRel5.vim')
  
lines =<< trim END
vim9script
***
*** 928,944 
END
v9.CheckScriptFailure(lines, 'E1049: Item not exported in script: notexp', 
1)
  
lines =<< trim END
vim9script
!   import autoload './XimportRel.vim'
def Func()
! XimportRel.notexp = 'bad'
enddef
Func()
END
v9.CheckScriptFailure(lines, 'E1049: Item not exported in script: notexp', 
1)
  
!   # does not fail if the script wasn't loaded yet
g:loaded = 'no'
lines =<< trim END
vim9script
--- 930,947 
END
v9.CheckScriptFailure(lines, 'E1049: Item not exported in script: notexp', 
1)
  
+   # Same, script not imported before
lines =<< trim END
vim9script
!   import autoload './XimportRel4.vim'
def Func()
! echo XimportRel4.notexp
enddef
Func()
END
v9.CheckScriptFailure(lines, 'E1049: Item not exported in script: notexp', 
1)
  
!   # does not fail if the script wasn't loaded yet and only compiling
g:loaded = 'no'
lines =<< trim END
vim9script
***
*** 951,956 
--- 954,969 
v9.CheckScriptSuccess(lines)
assert_equal('no', g:loaded)
  
+   lines =<< trim END
+   vim9script
+   import autoload './XimportRel.vim'
+   def Func()
+ XimportRel.notexp = 'bad'
+   enddef
+   Func()
+   END
+   v9.CheckScriptFailure(lines, 'E1049: Item not exported in script: notexp', 
1)
+ 
# fails with a not loaded import
lines =<< trim END
vim9script
***
*** 964,972 
--- 977,1013 
assert_equal('yes', g:loaded)
unlet g:loaded
  
+   lines =<< trim END
+   vim9script
+   import autoload './XimportRel5.vim'
+   def Func()
+ XimportRel5.nosuchvar = 'bad'
+   enddef
+   Func()
+   END
+   v9.CheckScriptFailure(lines, 'E121: Undefined variable: nosuchvar', 1)
+   unlet g:loaded
+ 
+   # nasty: delete script after compiling function
+   writefile(['vim9script'], 'XimportRelDel.vim')
+   lines =<< trim END
+   vim9script
+ 
+   import autoload './XimportRelDel.vim'
+   def DoIt()
+ echo XimportRelDel.var
+   enddef
+   defcompile
+   delete('XimportRelDel.vim')
+   DoIt()
+   END
+   v9.CheckScriptFailure(lines, 'E456:')
+ 
delete('XimportRel.vim')
delete('XimportRel2.vim')
delete('XimportRel3.vim')
+   delete('XimportRel4.vim')
+   delete('XimportRel5.vim')
  enddef
  
  def Test_autoload_import_relative_autoload_dir()
***
*** 1576,1585 
var lines =<< trim END
vim9script
  
!   if exists('g:loaded')
  finish
endif
!   g:loaded = 1
delcommand CallFunc
command CallFunc Func()
def Func()
--- 1617,1626 
var lines =<< trim END
vim9script
  
!   if exists('g:loadedThis')
  finish
endif
!   g:loadedThis = 1
delcommand CallFunc
command CallFunc Func()
def Func()
***
*** 1594,1600 
  
delete('XreloadFunc.vim')
delcommand CallFunc
!   unlet g:loaded
unlet g:didTheFunc
 

Re: [vim/vim] Optionally display error messages if expansion fails with expandcmd() (PR #10071)

2022-04-03 Fir de Conversatie Yegappan Lakshmanan
Hi,

On Sun, Apr 3, 2022 at 11:14 AM LemonBoy  wrote:

> *@LemonBoy* commented on this pull request.
> --
>
> In src/evalfunc.c
> :
>
> > return;
>
> +if (argvars[1].v_type == VAR_DICT
> + && dict_has_key(argvars[1].vval.v_dict, "errmsg", -1))
>
> Shouldn't this be dict_get_bool? if errmsg is present but set to v:false
> then emsgoff should not be set to false.
>
>
>
Yes. I have updated the PR with this change.

- Yegappan

-- 
-- 
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/CAAW7x7m-yv8OSjdVADqELq%2Bi9XrbwOMgr_B%3DC9LbHfEECg9iFg%40mail.gmail.com.


Re: [vim/vim] Optionally display error messages if expansion fails with expandcmd() (PR #10071)

2022-04-03 Fir de Conversatie Yegappan Lakshmanan
Hi Bram,

On Sun, Apr 3, 2022 at 10:52 AM Bram Moolenaar 
wrote:

> ASAN reports a leak, perhaps something is not cleared on failure?
>
>
>
Yes. The new test exposed an existing memory leak. I have updated the PR
with a fix.

- Yegappan

-- 
-- 
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/CAAW7x7kbGeYLpEsMsZY5%3Dj%2BrEeu74-Uwt9593DDbsyzKgQA39w%40mail.gmail.com.


Patch 8.2.4676

2022-04-03 Fir de Conversatie Bram Moolenaar


Patch 8.2.4676 (after 8.2.4675)
Problem:Test fails with different error.
Solution:   Add argument for :elseif.
Files:  src/testdir/test_vimscript.vim


*** ../vim-8.2.4675/src/testdir/test_vimscript.vim  2022-03-22 
21:14:51.756456002 +
--- src/testdir/test_vimscript.vim  2022-04-03 16:57:34.341166820 +0100
***
*** 3025,3031 
  
" :elseif without :if
let code =<< trim END
! elseif
END
call writefile(code, 'Xtest')
call AssertException(['source Xtest'], 'Vim(elseif):E582: :elseif without 
:if')
--- 3025,3031 
  
" :elseif without :if
let code =<< trim END
! elseif 1
END
call writefile(code, 'Xtest')
call AssertException(['source Xtest'], 'Vim(elseif):E582: :elseif without 
:if')
***
*** 3033,3039 
" :elseif without :if
let code =<< trim END
  while 1
!   elseif
  endwhile
END
call writefile(code, 'Xtest')
--- 3033,3039 
" :elseif without :if
let code =<< trim END
  while 1
!   elseif 1
  endwhile
END
call writefile(code, 'Xtest')
***
*** 3043,3049 
let code =<< trim END
  try
  finally
!   elseif
  endtry
END
call writefile(code, 'Xtest')
--- 3043,3049 
let code =<< trim END
  try
  finally
!   elseif 1
  endtry
END
call writefile(code, 'Xtest')
***
*** 3052,3058 
" :elseif without :if
let code =<< trim END
  try
!   elseif
  endtry
END
call writefile(code, 'Xtest')
--- 3052,3058 
" :elseif without :if
let code =<< trim END
  try
!   elseif 1
  endtry
END
call writefile(code, 'Xtest')
***
*** 3063,3069 
  try
throw "a"
  catch /a/
!   elseif
  endtry
END
call writefile(code, 'Xtest')
--- 3063,3069 
  try
throw "a"
  catch /a/
!   elseif 1
  endtry
END
call writefile(code, 'Xtest')
*** ../vim-8.2.4675/src/version.c   2022-04-03 16:13:03.420370565 +0100
--- src/version.c   2022-04-03 16:58:37.881137187 +0100
***
*** 752,753 
--- 752,755 
  {   /* Add new patch number below this line */
+ /**/
+ 4676,
  /**/

-- 
BRIDGEKEEPER: What is your favorite colour?
LAUNCELOT:Blue.
BRIDGEKEEPER: Right.  Off you go.
 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// 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/20220403155951.F2BBA1C0561%40moolenaar.net.


Patch 8.2.4675

2022-04-03 Fir de Conversatie Bram Moolenaar


Patch 8.2.4675
Problem:No error for missing expression after :elseif. (Ernie Rael)
Solution:   Check for missing expression. (closes #10068)
Files:  src/ex_eval.c, src/testdir/test_vim9_script.vim


*** ../vim-8.2.4674/src/ex_eval.c   2022-03-03 15:11:15.082646961 +
--- src/ex_eval.c   2022-04-03 16:08:39.336652634 +0100
***
*** 1146,1152 
  
  if (eap->cmdidx == CMD_elseif)
  {
!   result = eval_to_bool(eap->arg, &error, eap, skip);
  
// When throwing error exceptions, we want to throw always the first
// of several errors in a row.  This is what actually happens when
--- 1146,1157 
  
  if (eap->cmdidx == CMD_elseif)
  {
!   // When skipping we ignore most errors, but a missing expression is
!   // wrong, perhaps it should have been "else".
!   if (skip && ends_excmd(*eap->arg))
!   semsg(_(e_invalid_expression_str), eap->arg);
!   else
!   result = eval_to_bool(eap->arg, &error, eap, skip);
  
// When throwing error exceptions, we want to throw always the first
// of several errors in a row.  This is what actually happens when
*** ../vim-8.2.4674/src/testdir/test_vim9_script.vim2022-04-02 
19:43:53.927491819 +0100
--- src/testdir/test_vim9_script.vim2022-04-03 16:12:19.748419484 +0100
***
*** 1605,1610 
--- 1605,1620 
endif
END
v9.CheckDefFailure(lines, 'E488:')
+ 
+   lines =<< trim END
+   var cond = true
+   if cond
+ echo 'true'
+   elseif
+ echo 'false'
+   endif
+   END
+   v9.CheckDefAndScriptFailure(lines, ['E1143:', 'E15:'], 4)
  enddef
  
  let g:bool_true = v:true
*** ../vim-8.2.4674/src/version.c   2022-04-03 15:46:57.389502603 +0100
--- src/version.c   2022-04-03 16:10:18.188551235 +0100
***
*** 752,753 
--- 752,755 
  {   /* Add new patch number below this line */
+ /**/
+ 4675,
  /**/

-- 
Permission is granted to read this message out aloud on Kings Cross Road,
London, under the condition that the orator is properly dressed.

 /// 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/20220403151336.ED72B1C0561%40moolenaar.net.


Patch 8.2.4674

2022-04-03 Fir de Conversatie Bram Moolenaar


Patch 8.2.4674
Problem:Cannot force getting MouseMove events.
Solution:   Add the 'mousemoveevent' option with implementaiton for the GUI.
(Ernie Rael, closes #10044)
Files:  runtime/doc/gui.txt, runtime/doc/options.txt,
runtime/doc/testing.txt, src/gui.c, src/option.h,
src/optiondefs.h, src/testing.c, src/testdir/test_gui.vim


*** ../vim-8.2.4673/runtime/doc/gui.txt 2021-01-31 16:02:06.250490190 +
--- runtime/doc/gui.txt 2022-04-03 15:26:22.057090243 +0100
***
*** 260,265 
--- 261,267 
  'mousefocus'  window focus follows mouse pointer |gui-mouse-focus|
  'mousemodel'  what mouse button does which action
  'mousehide'   hide mouse pointer while typing text
+ 'mousemoveevent' enable mouse move events so that  can be mapped
  'selectmode'  whether to start Select mode or Visual mode
  
  A quick way to set these is with the ":behave" command.
***
*** 405,417 
  application, with shift-left mouse allowing for extending the visual area
  rather than the right mouse button.
  
  Mouse mapping with modifiers does not work for modeless selection.
  
  
  3.7 Drag and drop *drag-n-drop*
  
  You can drag and drop one or more files into the Vim window, where they will
! be opened as if a |:drop| command was used.
  
  If you hold down Shift while doing this, Vim changes to the first dropped
  file's directory.  If you hold Ctrl Vim will always split a new window for the
--- 407,423 
  application, with shift-left mouse allowing for extending the visual area
  rather than the right mouse button.
  
+  may be mapped, but 'mousemoveevent' must be enabled to use the
+ mapping.
+ 
  Mouse mapping with modifiers does not work for modeless selection.
  
  
  3.7 Drag and drop *drag-n-drop*
  
  You can drag and drop one or more files into the Vim window, where they will
! be opened as if a |:drop| command was used.  You can check if this is
! supported with the *drop_file* feature: `has('drop_file')`.
  
  If you hold down Shift while doing this, Vim changes to the first dropped
  file's directory.  If you hold Ctrl Vim will always split a new window for the
*** ../vim-8.2.4673/runtime/doc/options.txt 2022-02-24 13:28:36.566222341 
+
--- runtime/doc/options.txt 2022-04-03 15:25:43.225290914 +0100
***
*** 5493,5498 
--- 5517,5534 
  
The 'mousemodel' option is set by the |:behave| command.
  
+   *'mousemoveevent'* *'mousemev'*
+ 'mousemoveevent' 'mousemev'  boolean  (default off)
+   global
+   {only works in the GUI}
+   When on, mouse move events are delivered to the input queue and are
+   available for mapping. The default, off, avoids the mouse movement
+   overhead except when needed. See |gui-mouse-mapping|.
+   Warning: Setting this option can make pending mappings to be aborted
+   when the mouse is moved.
+   Currently only works in the GUI, may be made to work in a terminal
+   later.
+ 
*'mouseshape'* *'mouses'* *E547*
  'mouseshape' 'mouses' string  (default "i-r:beam,s:updown,sd:udsizing,
vs:leftright,vd:lrsizing,m:no,
*** ../vim-8.2.4673/runtime/doc/testing.txt 2022-01-30 18:00:22.703274483 
+
--- runtime/doc/testing.txt 2022-04-03 15:31:09.675873524 +0100
***
*** 125,132 
forward:set to 1 for forward search.
  
"mouse":
! Inject a mouse button click event.  The supported items in
! {args} are:
button: mouse button.  The supported values are:
0   right mouse button
1   middle mouse button
--- 131,138 
forward:set to 1 for forward search.
  
"mouse":
! Inject either a mouse button click, or a mouse move, event.
! The supported items in {args} are:
button: mouse button.  The supported values are:
0   right mouse button
1   middle mouse button
***
*** 145,150 
--- 151,178 
4   shift is pressed
8   alt is pressed
   16   ctrl is pressed
+   move:   Optional; if used and TRUE then a mouse move
+   event can be generated.
+   Only {args} row: and col: are used and
+   required; they are interpreted as pixels.
+   Only results in an event when 'mousemoveevent'
+   is set

Patch 8.2.4673

2022-04-03 Fir de Conversatie Bram Moolenaar


Patch 8.2.4673
Problem:Redrawing a vertically split window is slow when using CTRL-F and
CTRL-B.
Solution:   When deciding on USE_REDRAW bail out if scrolling more than three
lines. (issue #8002)
Files:  src/screen.c


*** ../vim-8.2.4672/src/screen.c2022-04-01 19:44:43.949807161 +0100
--- src/screen.c2022-04-03 13:17:37.951718866 +0100
***
*** 3707,3713 
--- 3707,3721 
   */
  result_empty = (row + line_count >= end);
  if (wp != NULL && wp->w_width != Columns && *T_CSV == NUL)
+ {
+   // Avoid that lines are first cleared here and then redrawn, which
+   // results in many characters updated twice.  This happens with CTRL-F
+   // in a vertically split window.  With line-by-line scrolling
+   // USE_REDRAW should be faster.
+   if (line_count > 3)
+   return FAIL;
type = USE_REDRAW;
+ }
  else if (can_clear(T_CD) && result_empty)
type = USE_T_CD;
  else if (*T_CAL != NUL && (line_count > 1 || *T_AL == NUL))
***
*** 3879,3885 
  int   end,
  int   force,  // even when line_count > p_ttyscroll
  int   clear_attr, // used for clearing lines
! win_T *wp UNUSED) // NULL or window to use width from
  {
  int   j;
  int   i;
--- 3887,3893 
  int   end,
  int   force,  // even when line_count > p_ttyscroll
  int   clear_attr, // used for clearing lines
! win_T *wp)// NULL or window to use width from
  {
  int   j;
  int   i;
***
*** 3934,3940 
--- 3942,3956 
   * 6. redraw the characters from ScreenLines[].
   */
  if (wp != NULL && wp->w_width != Columns && *T_CSV == NUL)
+ {
+   // Avoid that lines are first cleared here and then redrawn, which
+   // results in many characters updated twice.  This happens with CTRL-F
+   // in a vertically split window.  With line-by-line scrolling
+   // USE_REDRAW should be faster.
+   if (line_count > 3)
+   return FAIL;
type = USE_REDRAW;
+ }
  else if (can_clear(T_CD) && result_empty)
type = USE_T_CD;
  else if (row == 0 && (
*** ../vim-8.2.4672/src/version.c   2022-04-03 12:59:29.358392492 +0100
--- src/version.c   2022-04-03 13:20:36.755190970 +0100
***
*** 752,753 
--- 752,755 
  {   /* Add new patch number below this line */
+ /**/
+ 4673,
  /**/

-- 
VOICE OVER: As the horrendous Black Beast lunged forward, escape for Arthur
and his knights seemed hopeless,  when, suddenly ... the animator
suffered a fatal heart attack.
ANIMATOR:   Agh!
VOICE OVER: The cartoon peril was no more ... The Quest for Holy Grail could
continue.
 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// 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/20220403122403.C978F1C0561%40moolenaar.net.


Patch 8.2.4672

2022-04-03 Fir de Conversatie Bram Moolenaar


Patch 8.2.4672
Problem:Using :normal with Ex mode may make :substitute hang.
Solution:   When getting an empty line behave like 'q' was typed.
(closes #10070)
Files:  src/ex_cmds.c, src/testdir/test_normal.vim


*** ../vim-8.2.4671/src/ex_cmds.c   2022-03-31 11:37:54.259367941 +0100
--- src/ex_cmds.c   2022-04-03 12:58:35.574383548 +0100
***
*** 4233,4238 
--- 4233,4243 
{
typed = *resp;
vim_free(resp);
+   // When ":normal" runs out of characters we get
+   // an empty line.  Use "q" to get out of the
+   // loop.
+   if (ex_normal_busy && typed == NUL)
+   typed = 'q';
}
}
else
*** ../vim-8.2.4671/src/testdir/test_normal.vim 2022-02-12 20:34:47.088825181 
+
--- src/testdir/test_normal.vim 2022-04-03 12:57:39.374373201 +0100
***
*** 2641,2646 
--- 2641,2655 
bw!
  endfunc
  
+ func Test_normal_ex_substitute()
+   " This was hanging on the substitute prompt.
+   new
+   call setline(1, 'a')
+   exe "normal! gggQs/a/b/c\"
+   call assert_equal('a', getline(1))
+   bwipe!
+ endfunc
+ 
  " Test for g CTRL-G
  func Test_g_ctrl_g()
new
*** ../vim-8.2.4671/src/version.c   2022-04-03 11:58:28.014196270 +0100
--- src/version.c   2022-04-03 12:59:23.350391540 +0100
***
*** 752,753 
--- 752,755 
  {   /* Add new patch number below this line */
+ /**/
+ 4672,
  /**/

-- 
I bought a book on hair loss, but the pages kept falling out.

 /// 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/20220403120024.D76B11C0561%40moolenaar.net.


Patch 8.2.4671

2022-04-03 Fir de Conversatie Bram Moolenaar


Patch 8.2.4671
Problem:'wildignorecase' is sometimes not used for glob().
Solution:   Also use 'wildignorecase' when there are no wildcards.
(closes #10066, closes #8350)
Files:  src/filepath.c, src/testdir/test_functions.vim


*** ../vim-8.2.4670/src/filepath.c  2022-03-31 11:37:54.255367937 +0100
--- src/filepath.c  2022-04-03 11:57:25.590406403 +0100
***
*** 3945,3957 
}
  
/*
!* If there are wildcards: Expand file names and add each match to
!* the list.  If there is no match, and EW_NOTFOUND is given, add
!* the pattern.
!* If there are no wildcards: Add the file name if it exists or
!* when EW_NOTFOUND is given.
 */
!   if (mch_has_exp_wildcard(p))
{
  #if defined(FEAT_SEARCHPATH)
if ((flags & EW_PATH)
--- 3945,3957 
}
  
/*
!* If there are wildcards or case-insensitive expansion is
!* required: Expand file names and add each match to the list.  If
!* there is no match, and EW_NOTFOUND is given, add the pattern.
!* Otherwise: Add the file name if it exists or when EW_NOTFOUND is
!* given.
 */
!   if (mch_has_exp_wildcard(p) || (flags & EW_ICASE))
{
  #if defined(FEAT_SEARCHPATH)
if ((flags & EW_PATH)
*** ../vim-8.2.4670/src/testdir/test_functions.vim  2022-03-15 
09:46:50.757054758 +
--- src/testdir/test_functions.vim  2022-04-03 11:51:51.319590450 +0100
***
*** 2821,2826 
--- 2821,2828 
" Sort output of glob() otherwise we end up with different
" ordering depending on whether file system is case-sensitive.
call assert_equal(['XGLOB2', 'Xglob1'], sort(glob('Xglob[12]', 0, 1)))
+   " wildignorecase shall be applied even when the pattern contains no 
wildcards.
+   call assert_equal('XGLOB2', glob('xglob2'))
set wildignorecase&
  
call delete('Xglob1')
*** ../vim-8.2.4670/src/version.c   2022-04-03 11:22:33.528172299 +0100
--- src/version.c   2022-04-03 11:53:36.347347715 +0100
***
*** 752,753 
--- 752,755 
  {   /* Add new patch number below this line */
+ /**/
+ 4671,
  /**/

-- 
Dreams are free, but there's a small charge for alterations.

 /// 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/20220403105945.1D1051C0561%40moolenaar.net.


Patch 8.2.4670

2022-04-03 Fir de Conversatie Bram Moolenaar


Patch 8.2.4670
Problem:Memory allocation failures for new tab page not tested.
Solution:   Add tests with failing memory allocation. (Yegappan Lakshmanan,
closes #10067)
Files:  src/alloc.h, src/blob.c, src/buffer.c, src/window.c,
src/testdir/test_blob.vim, src/testdir/test_buffer.vim,
src/testdir/test_tabpage.vim, src/testdir/test_window_cmd.vim


*** ../vim-8.2.4669/src/alloc.h 2022-04-02 21:46:14.989612828 +0100
--- src/alloc.h 2022-04-03 11:14:32.028202466 +0100
***
*** 40,45 
  aid_sign_getplaced_list,
  aid_insert_sign,
  aid_sign_getinfo,
! aid_buflistnew_bvars,
  aid_last
  } alloc_id_T;
--- 40,48 
  aid_sign_getplaced_list,
  aid_insert_sign,
  aid_sign_getinfo,
! aid_newbuf_bvars,
! aid_newwin_wvars,
! aid_newtabpage_tvars,
! aid_blob_alloc,
  aid_last
  } alloc_id_T;
*** ../vim-8.2.4669/src/blob.c  2022-01-28 15:28:00.200927841 +
--- src/blob.c  2022-04-03 11:14:32.028202466 +0100
***
*** 22,28 
  blob_T *
  blob_alloc(void)
  {
! blob_T *blob = ALLOC_CLEAR_ONE(blob_T);
  
  if (blob != NULL)
ga_init2(&blob->bv_ga, 1, 100);
--- 22,28 
  blob_T *
  blob_alloc(void)
  {
! blob_T *blob = ALLOC_CLEAR_ONE_ID(blob_T, aid_blob_alloc);
  
  if (blob != NULL)
ga_init2(&blob->bv_ga, 1, 100);
*** ../vim-8.2.4669/src/buffer.c2022-04-02 21:46:14.989612828 +0100
--- src/buffer.c2022-04-03 11:14:32.028202466 +0100
***
*** 2093,2099 
}
  #ifdef FEAT_EVAL
// init b: variables
!   buf->b_vars = dict_alloc_id(aid_buflistnew_bvars);
if (buf->b_vars == NULL)
{
vim_free(ffname);
--- 2093,2099 
}
  #ifdef FEAT_EVAL
// init b: variables
!   buf->b_vars = dict_alloc_id(aid_newbuf_bvars);
if (buf->b_vars == NULL)
{
vim_free(ffname);
*** ../vim-8.2.4669/src/window.c2022-04-02 21:46:14.989612828 +0100
--- src/window.c2022-04-03 11:14:32.028202466 +0100
***
*** 3801,3806 
--- 3801,3808 
  win_alloc_firstwin(win_T *oldwin)
  {
  curwin = win_alloc(NULL, FALSE);
+ if (curwin == NULL)
+   return FAIL;
  if (oldwin == NULL)
  {
// Very first window, need to create an empty buffer for it and
***
*** 3882,3888 
  
  # ifdef FEAT_EVAL
  // init t: variables
! tp->tp_vars = dict_alloc();
  if (tp->tp_vars == NULL)
  {
vim_free(tp);
--- 3884,3890 
  
  # ifdef FEAT_EVAL
  // init t: variables
! tp->tp_vars = dict_alloc_id(aid_newtabpage_tvars);
  if (tp->tp_vars == NULL)
  {
vim_free(tp);
***
*** 5020,5026 
  
  #ifdef FEAT_EVAL
  // init w: variables
! new_wp->w_vars = dict_alloc();
  if (new_wp->w_vars == NULL)
  {
win_free_lsize(new_wp);
--- 5022,5028 
  
  #ifdef FEAT_EVAL
  // init w: variables
! new_wp->w_vars = dict_alloc_id(aid_newwin_wvars);
  if (new_wp->w_vars == NULL)
  {
win_free_lsize(new_wp);
*** ../vim-8.2.4669/src/testdir/test_blob.vim   2022-01-29 21:45:30.481921547 
+
--- src/testdir/test_blob.vim   2022-04-03 11:14:32.028202466 +0100
***
*** 702,705 
--- 702,744 
call assert_equal(v, string(b))
  endfunc
  
+ " Test for blob allocation failure
+ func Test_blob_alloc_failure()
+   " blob variable
+   call test_alloc_fail(GetAllocId('blob_alloc'), 0, 0)
+   call assert_fails('let v = 0z10', 'E342:')
+ 
+   " blob slice
+   let v = 0z1020
+   call test_alloc_fail(GetAllocId('blob_alloc'), 0, 0)
+   call assert_fails('let x = v[0:0]', 'E342:')
+   call assert_equal(0z1020, x)
+ 
+   " blob remove()
+   let v = 0z10203040
+   call test_alloc_fail(GetAllocId('blob_alloc'), 0, 0)
+   call assert_fails('let x = remove(v, 1, 2)', 'E342:')
+   call assert_equal(0, x)
+ 
+   " list2blob()
+   call test_alloc_fail(GetAllocId('blob_alloc'), 0, 0)
+   call assert_fails('let a = list2blob([1, 2, 4])', 'E342:')
+   call assert_equal(0, a)
+ 
+   " mapnew()
+   call test_alloc_fail(GetAllocId('blob_alloc'), 0, 0)
+   call assert_fails('let x = mapnew(0z1234, {_, v -> 1})', 'E342:')
+   call assert_equal(0, x)
+ 
+   " copy()
+   call test_alloc_fail(GetAllocId('blob_alloc'), 0, 0)
+   call assert_fails('let x = copy(v)', 'E342:')
+   call assert_equal(0z, x)
+ 
+   " readblob()
+   call test_alloc_fail(GetAllocId('blob_alloc'), 0, 0)
+   call assert_fails('let x = readblob("test_blob.vim")', 'E342:')
+   call assert_equal(0, x)
+ endfunc
+ 
  " vim: shiftwidth=2 sts=2 expandtab
*** ../vim-8.2.4669/src/testdir/test_buffer.vim 2022-04-02 21:46:14.989612828 
+0100
--- src/testdir/test_buffer.vim 2022-04-03 11:14:32.028202466 +0100
***
*** 430,479 
set maxmem& maxmemtot&
  endfunc
  
! " Test for a allocation failure when adding a new buffer
  func Test_buflist_alloc_failure()
%