Re: [vim/vim] Enable new diff option linematch (PR #9661)

2022-01-30 Thread Gary Johnson
On 2022-01-29, Jonathon wrote:
> This pull request is an algorithm I've written and tested / developed over the
> past year to improve the diff mode of neovim, applied as a patch to vim.

I just started playing with this.  I applied your 9661.patch to Vim
8.2.4257.  Then, with .../vim/src first in my PATH and "silent! set
diffopt+=linematch:60" in my vimrc, I executed "git difftool" in the
.../vim directory to see how your algorithm affected the results.
The first file opened with these messages.

"runtime/doc/options.txt" 9293L, 403236B
Error detected while processing command line:
E341: Internal error: lalloc(0, )

I realize that I haven't accounted for or tried to minimize my
configuration, but I hoped this would be useful anyway.

I did this on a system running Ubuntu 20.04.3, remotely over ssh
from a Crosh terminal on a Chromebook.

Regards,
Gary

-- 
-- 
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/20220130084445.GA28635%40phoenix.


Re: [vim/vim] Enable new diff option linematch (PR #9661)

2022-01-30 Thread Gary Johnson
On 2022-01-30, Gary Johnson wrote:
> On 2022-01-29, Jonathon wrote:
> > This pull request is an algorithm I've written and tested / developed over 
> > the
> > past year to improve the diff mode of neovim, applied as a patch to vim.
> 
> I just started playing with this.  I applied your 9661.patch to Vim
> 8.2.4257.  Then, with .../vim/src first in my PATH and "silent! set
> diffopt+=linematch:60" in my vimrc, I executed "git difftool" in the
> .../vim directory to see how your algorithm affected the results.
> The first file opened with these messages.
> 
> "runtime/doc/options.txt" 9293L, 403236B
> Error detected while processing command line:
> E341: Internal error: lalloc(0, )

I neglected to include the entire 'diffopt' setting at the time of
the error:

  
diffopt=internal,filler,indent-heuristic,algorithm:patience,vertical,linematch:60

Regards,
Gary

-- 
-- 
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/20220130090427.GA744%40phoenix.


Patch 8.2.4258

2022-01-30 Thread Bram Moolenaar


Patch 8.2.4258
Problem:Coverity warns for array overrun.
Solution:   Restrict depth to MAXWLEN - 1.
Files:  src/spellsuggest.c


*** ../vim-8.2.4257/src/spellsuggest.c  2022-01-29 11:22:11.827641991 +
--- src/spellsuggest.c  2022-01-30 12:07:12.509672469 +
***
*** 1214,1220 
  
  // Check the maximum score, if we go over it we won't try this change.
  #define TRY_DEEPER(su, stack, depth, add) \
!  (depth < MAXWLEN && stack[depth].ts_score + (add) < su->su_maxscore)
  
  /*
   * Try finding suggestions by adding/removing/swapping letters.
--- 1214,1220 
  
  // Check the maximum score, if we go over it we won't try this change.
  #define TRY_DEEPER(su, stack, depth, add) \
!(depth < MAXWLEN - 1 && stack[depth].ts_score + (add) < 
su->su_maxscore)
  
  /*
   * Try finding suggestions by adding/removing/swapping letters.
***
*** 1373,1379 
  
// At end of a prefix or at start of prefixtree: check for
// following word.
!   if (depth < MAXWLEN
&& (byts[arridx] == 0 || n == (int)STATE_NOPREFIX))
{
// Set su->su_badflags to the caps type at this position.
--- 1373,1379 
  
// At end of a prefix or at start of prefixtree: check for
// following word.
!   if (depth < MAXWLEN - 1
&& (byts[arridx] == 0 || n == (int)STATE_NOPREFIX))
{
// Set su->su_badflags to the caps type at this position.
*** ../vim-8.2.4257/src/version.c   2022-01-29 21:45:30.489921423 +
--- src/version.c   2022-01-30 12:10:04.251593581 +
***
*** 752,753 
--- 752,755 
  {   /* Add new patch number below this line */
+ /**/
+ 4258,
  /**/

-- 
Friends?  I have lots of friends!  In fact, I have all episodes ever made.

 /// 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/20220130121104.A36941C1933%40moolenaar.net.


Patch 8.2.4259

2022-01-30 Thread Bram Moolenaar


Patch 8.2.4259
Problem:Number of test functions for GUI events is growing.
Solution:   Use one function with a dictionary. (Yegappan Lakshmanan,
closes #9660)
Files:  runtime/doc/builtin.txt, runtime/doc/testing.txt,
runtime/doc/usr_41.txt, src/evalfunc.c, src/proto/testing.pro,
src/testdir/test_gui.vim, src/testdir/test_vim9_builtin.vim,
src/testing.c


*** ../vim-8.2.4258/runtime/doc/builtin.txt 2022-01-29 13:06:19.336028749 
+
--- runtime/doc/builtin.txt 2022-01-30 12:28:31.920244465 +
***
*** 642,654 
  test_garbagecollect_now() nonefree memory right now for testing
  test_garbagecollect_soon()nonefree memory soon for testing
  test_getvalue({string})   any get value of an internal 
variable
! test_gui_drop_files({list}, {row}, {col}, {mods})
!   nonedrop a list of files in a window
! test_gui_mouse_event({button}, {row}, {col}, {repeated}, {mods})
!   noneadd a mouse event to the input buffer
! test_gui_tabline_event({tabnr}) Bool  add a tabline event to the input buffer
! test_gui_tabmenu_event({tabnr}, {event})
!   noneadd a tabmenu event to the input buffer
  test_ignore_error({expr}) noneignore a specific error
  test_null_blob()  Blobnull value for testing
  test_null_channel()   Channel null value for testing
--- 642,648 
  test_garbagecollect_now() nonefree memory right now for testing
  test_garbagecollect_soon()nonefree memory soon for testing
  test_getvalue({string})   any get value of an internal 
variable
! test_gui_event({event}, {args})   boolgenerate a GUI event for testing
  test_ignore_error({expr}) noneignore a specific error
  test_null_blob()  Blobnull value for testing
  test_null_channel()   Channel null value for testing
*** ../vim-8.2.4258/runtime/doc/testing.txt 2022-01-27 13:16:54.328078845 
+
--- runtime/doc/testing.txt 2022-01-30 12:28:31.920244465 +
***
*** 79,141 
Can also be used as a |method|: >
GetName()->test_getvalue()
  <
!   *test_gui_drop_files()*
! test_gui_drop_files({list}, {row}, {col}, {mods})
!   Drop one or more files in {list} in the window at {row}, {col}.
!   This function only works when the GUI is running.
!   
!   The supported values for {mods} are:
!   0x4 Shift
!   0x8 Alt
!   0x10Ctrl
!   The files are added to the argument list and the first file in
!   {list} is edited in the window.  See |drag-n-drop| for more
!   information.
! 
!   *test_gui_mouse_event()*
! test_gui_mouse_event({button}, {row}, {col}, {multiclick}, {modifiers})
!   Inject a mouse button click event.  This function only works
!   when the GUI is running.
!   The supported values for {button} are:
!   0   right mouse button
!   1   middle mouse button
!   2   left mouse button
!   3   mouse button release
!   4   scroll wheel down
!   5   scroll wheel up
!   6   scroll wheel left
!   7   scroll wheel right
!   {row} and {col} specify the location of the mouse click. The
!   first row of the Vim window is 1 and the last row is 'lines'.
!   The maximum value of {col} is 'columns'.
!   To inject a multiclick event, set {multiclick} to 1.
!   The supported values for {modifiers} are:
!   4   shift is pressed
!   8   alt is pressed
!   16  ctrl is pressed
!   After injecting the mouse event you probably should call
!   |feedkeys()| to have them processed, e.g.: >
!   call feedkeys("y", 'Lx!')
  
!   *test_gui_tabline_event()*
! test_gui_tabline_event({tabnr})
!   Add an event that simulates a click on the tabline to select
!   tabpage {tabnr} to the input buffer.
!   Returns TRUE if the event is successfully added, FALSE if
!   already in the tabpage {tabnr} or the cmdline window is open.
!   After injecting the event you probably should call
!   |feedkeys()| to have them processed, e.g.: >
!   call feedkeys("y", 'Lx!')
! 
!   *test_gui_tabmenu_event()*
! test_gui_tabmenu_event(

Patch 8.2.4260

2022-01-30 Thread Bram Moolenaar


Patch 8.2.4260
Problem:Vim9: can still use a global function without g: at the script
level.
Solution:   Also check for g: at the script level. (issue #9637)
Files:  src/userfunc.c, src/proto/userfunc.pro, src/evalvars.c,
src/vim9expr.c, src/testdir/test_vim9_assign.vim,
src/testdir/test_vim9_builtin.vim, src/testdir/test_vim9_cmd.vim,
src/testdir/test_vim9_disassemble.vim,
src/testdir/test_vim9_expr.vim, src/testdir/test_vim9_func.vim,
src/testdir/test_vim9_import.vim,
src/testdir/test_ins_complete.vim, src/testdir/test_popupwin.vim,
src/testdir/dumps/Test_popupwin_scroll_11.dump,
src/testdir/dumps/Test_popupwin_scroll_12.dump


*** ../vim-8.2.4259/src/userfunc.c  2022-01-29 21:45:30.473921671 +
--- src/userfunc.c  2022-01-30 15:03:15.623749253 +
***
*** 1902,1908 
  char_ubuffer[200];
  scriptitem_T*si;
  
! if (vim_strchr(name, AUTOLOAD_CHAR) != 0)
return NULL;// already has the prefix
  if (!SCRIPT_ID_VALID(sid))
return NULL;// not in a script
--- 1902,1908 
  char_ubuffer[200];
  scriptitem_T*si;
  
! if (vim_strchr(name, AUTOLOAD_CHAR) != NULL)
return NULL;// already has the prefix
  if (!SCRIPT_ID_VALID(sid))
return NULL;// not in a script
***
*** 2005,2010 
--- 2005,2021 
  }
  
  /*
+  * Return TRUE if "ufunc" must be called with a g: prefix in Vim9 script.
+  */
+ int
+ func_requires_g_prefix(ufunc_T *ufunc)
+ {
+ return ufunc->uf_name[0] != K_SPECIAL
+   && (ufunc->uf_flags & FC_LAMBDA) == 0
+   && vim_strchr(ufunc->uf_name, AUTOLOAD_CHAR) == NULL;
+ }
+ 
+ /*
   * Copy the function name of "fp" to buffer "buf".
   * "buf" must be able to hold the function name plus three bytes.
   * Takes care of script-local function names.
***
*** 3442,3448 
--- 3453,3466 
 * User defined function.
 */
if (fp == NULL)
+   {
fp = find_func(rfname, is_global);
+   if (fp != NULL && !is_global && in_vim9script()
+&& func_requires_g_prefix(fp))
+   // In Vim9 script g: is required to find a global
+   // non-autoload function.
+   fp = NULL;
+   }
  
// Trigger FuncUndefined event, may load the function.
if (fp == NULL
***
*** 3672,3677 
--- 3690,3696 
  char_usid_buf[20];
  int   len;
  int   extra = 0;
+ int   prefix_g = FALSE;
  lval_Tlv;
  int   vim9script;
  
***
*** 3837,3844 
// skip over "s:" and "g:"
if (lead == 2 || (lv.ll_name[0] == 'g' && lv.ll_name[1] == ':'))
{
!   if (is_global != NULL && lv.ll_name[0] == 'g')
!   *is_global = TRUE;
lv.ll_name += 2;
}
len = (int)(end - lv.ll_name);
--- 3856,3875 
// skip over "s:" and "g:"
if (lead == 2 || (lv.ll_name[0] == 'g' && lv.ll_name[1] == ':'))
{
!   if (lv.ll_name[0] == 'g')
!   {
!   if (is_global != NULL)
!   {
!   *is_global = TRUE;
!   }
!   else
!   {
!   // dropping "g:" without setting "is_global" won't work in
!   // Vim9script, put it back later
!   prefix_g = TRUE;
!   extra = 2;
!   }
!   }
lv.ll_name += 2;
}
len = (int)(end - lv.ll_name);
***
*** 3919,3924 
--- 3950,3960 
if (vim9script || lead > 3) // If it's ""
STRCPY(name + 3, sid_buf);
}
+   else if (prefix_g)
+   {
+   name[0] = 'g';
+   name[1] = ':';
+   }
mch_memmove(name + lead + extra, lv.ll_name, (size_t)len);
name[lead + extra + len] = NUL;
  }
*** ../vim-8.2.4259/src/proto/userfunc.pro  2022-01-24 13:54:42.298380706 
+
--- src/proto/userfunc.pro  2022-01-30 14:27:25.642302302 +
***
*** 11,16 
--- 11,17 
  ufunc_T *find_func_even_dead(char_u *name, int flags);
  ufunc_T *find_func(char_u *name, int is_global);
  int func_is_global(ufunc_T *ufunc);
+ int func_requires_g_prefix(ufunc_T *ufunc);
  int func_name_refcount(char_u *name);
  void func_clear_free(ufunc_T *fp, int force);
  int copy_func(char_u *lambda, char_u *global, ectx_T *ectx);
*** ../vim-8.2.4259/src/evalvars.c  2022-01-26 21:01:11.188928567 +
--- src/evalvars.c  2022-01-30 14:26:43.47890 +
***
*** 2779,2795 
}
else if (in_vim9script() && (flags & EVAL_VAR_NO_FUNC) == 0)
{
ufunc_T *ufun

Patch 8.2.4261

2022-01-30 Thread Bram Moolenaar


Patch 8.2.4261
Problem:Accessing invalid memory when a regular expression checks the
Visual area while matching in a string.
Solution:   Do not try matching the Visual area in a string.
Files:  src/regexp.c, src/testdir/test_help.vim


*** ../vim-8.2.4260/src/regexp.c2022-01-05 20:24:34.276005641 +
--- src/regexp.c2022-01-30 16:41:32.350739976 +
***
*** 1267,1274 
  colnr_T   cols;
  colnr_T   curswant;
  
! // Check if the buffer is the current buffer.
! if (rex.reg_buf != curbuf || VIsual.lnum == 0)
return FALSE;
  
  if (VIsual_active)
--- 1267,1274 
  colnr_T   cols;
  colnr_T   curswant;
  
! // Check if the buffer is the current buffer and not using a string.
! if (rex.reg_buf != curbuf || VIsual.lnum == 0 || rex.reg_maxline == 0)
return FALSE;
  
  if (VIsual_active)
*** ../vim-8.2.4260/src/testdir/test_help.vim   2022-01-03 12:53:20.662699885 
+
--- src/testdir/test_help.vim   2022-01-30 16:40:38.583614348 +
***
*** 1,6 
--- 1,7 
  " Tests for :help
  
  source check.vim
+ import './vim9.vim' as v9
  
  func Test_help_restore_snapshot()
help
***
*** 168,172 
--- 169,183 
endtry
  endfunc
  
+ func Test_help_using_visual_match()
+   let lines =<< trim END
+   call setline(1, ' ')
+   /^
+   exe "normal \\"
+   h5\%V€]
+   END
+   call v9.CheckScriptFailure(lines, 'E149:')
+ endfunc
+ 
  
  " vim: shiftwidth=2 sts=2 expandtab
*** ../vim-8.2.4260/src/version.c   2022-01-30 15:28:26.646294975 +
--- src/version.c   2022-01-30 16:11:17.545709897 +
***
*** 752,753 
--- 752,755 
  {   /* Add new patch number below this line */
+ /**/
+ 4261,
  /**/

-- 
DENNIS: Oh, very nice. King, eh!  I expect you've got a palace and fine
clothes and courtiers and plenty of food.  And how d'you get that?  By
exploiting the workers! By hanging on to outdated imperialist dogma
which perpetuates the social and economic differences in our society!
 "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/20220130164349.F0D281C1918%40moolenaar.net.


Patch 8.2.4262

2022-01-30 Thread Bram Moolenaar


Patch 8.2.4262 (after 8.2.4261)
Problem:Some search tests fail.
Solution:   Use a better way to reject searching for the Visual area.
Files:  src/regexp.c


*** ../vim-8.2.4261/src/regexp.c2022-01-30 16:42:52.501450826 +
--- src/regexp.c2022-01-30 17:15:33.407283151 +
***
*** 1268,1274 
  colnr_T   curswant;
  
  // Check if the buffer is the current buffer and not using a string.
! if (rex.reg_buf != curbuf || VIsual.lnum == 0 || rex.reg_maxline == 0)
return FALSE;
  
  if (VIsual_active)
--- 1268,1274 
  colnr_T   curswant;
  
  // Check if the buffer is the current buffer and not using a string.
! if (rex.reg_buf != curbuf || VIsual.lnum == 0 || !REG_MULTI)
return FALSE;
  
  if (VIsual_active)
*** ../vim-8.2.4261/src/version.c   2022-01-30 16:42:52.505450760 +
--- src/version.c   2022-01-30 17:17:10.349722272 +
***
*** 752,753 
--- 752,755 
  {   /* Add new patch number below this line */
+ /**/
+ 4262,
  /**/

-- 
OLD WOMAN: King of the WHO?
ARTHUR:The Britons.
OLD WOMAN: Who are the Britons?
 "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/20220130171930.B75E11C1918%40moolenaar.net.


Patch 8.2.4263

2022-01-30 Thread Bram Moolenaar


Patch 8.2.4263
Problem:No test for the GUI find/replace dialog.
Solution:   Add a test function and a test. (Yegappan Lakshmanan,
closes #9662)
Files:  runtime/doc/testing.txt, src/testdir/test_gui.vim, src/testing.c


*** ../vim-8.2.4262/runtime/doc/testing.txt 2022-01-30 12:36:48.728985579 
+
--- runtime/doc/testing.txt 2022-01-30 17:48:49.753051744 +
***
*** 82,91 
*test_gui_event()*
  test_gui_event({event}, {args})
Generate a GUI {event} with arguments {args} for testing Vim
!   functionality.
  
{event} is a String and the supported values are:
"dropfiles" drop one or more files in a window.
"mouse" mouse button click event.
"tabline"   select a tab page by mouse click.
"tabmenu"   select a tabline menu entry.
--- 85,96 
*test_gui_event()*
  test_gui_event({event}, {args})
Generate a GUI {event} with arguments {args} for testing Vim
!   functionality. This function works only when the GUI is
!   running.
  
{event} is a String and the supported values are:
"dropfiles" drop one or more files in a window.
+   "findrepl"  search and replace text
"mouse" mouse button click event.
"tabline"   select a tab page by mouse click.
"tabmenu"   select a tabline menu entry.
***
*** 104,115 
   0x10 Ctrl
  The files are added to the |argument-list| and the first
  file in {files} is edited in the window.  See |drag-n-drop|
! for more information.  This function only works when the GUI
! is running and the |drop_file| feature is present.
  
"mouse":
! Inject a mouse button click event.  This function only works
! when the GUI is running. The supported items in {args} are:
button: mouse button.  The supported values are:
0   right mouse button
1   middle mouse button
--- 109,135 
   0x10 Ctrl
  The files are added to the |argument-list| and the first
  file in {files} is edited in the window.  See |drag-n-drop|
! for more information.  This event works only when the
! |drop_file| feature is present.
! 
!   "findrepl":
! Perform a search and replace of text.  The supported items
! in {args} are:
!   find_text:  string to find.
!   repl_text:  replacement string
!   flags:  flags controlling the find/replace. Supported
!   values are:
!   1   search next string (find dialog)
!   2   search next string (replace dialog)
!   3   replace string once
!   4   replace all matches
!   8   match whole words only
!  16   match case
!   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
*** ../vim-8.2.4262/src/testdir/test_gui.vim2022-01-30 12:36:48.732985521 
+
--- src/testdir/test_gui.vim2022-01-30 17:48:49.753051744 +
***
*** 1255,1264 
  func Test_gui_drop_files()
CheckFeature drop_file
  
-   call assert_false(test_gui_event("dropfiles", {}))
-   let d = #{row: 1, col: 1, modifiers: 0}
-   call assert_false(test_gui_event("dropfiles", d))
- 
%bw!
%argdelete
let d = #{files: [], row: 1, col: 1, modifiers: 0}
--- 1255,1260 
***
*** 1345,1350 
--- 1341,1355 
call feedkeys('k', 'Lx!')
call assert_equal('"a.c b.c', @:)
cunmap  
+ 
+   " Invalid arguments
+   call assert_false(test_gui_event("dropfiles", {}))
+   let d = #{row: 1, col: 1, modifiers: 0}
+   call assert_false(test_gui_event("dropfiles", d))
+   let d = #{files: test_null_list(), row: 1, col: 1, modifiers: 0}
+   call assert_false(test_gui_event("dropfiles", d))
+   let d = #{files: [test_null_string()], row: 1, col: 1, modifiers: 0}
+   call assert_true(test_gui_event("dropfiles", d))
  endfunc
  
  " Test for generating a GUI tabline event to select a tab page
**

Patch 8.2.4264

2022-01-30 Thread Bram Moolenaar


Patch 8.2.4264
Problem:Vim9: can use old style autoload function name.
Solution:   Give an error for old style autoload function name.
Files:  src/errors.h, src/userfunc.c, src/testdir/test_vim9_import.vim,
src/testdir/test_vim9_func.vim, src/testdir/test_vim9_script.vim


*** ../vim-8.2.4263/src/errors.h2022-01-28 21:00:47.659144775 +
--- src/errors.h2022-01-30 18:23:36.394622009 +
***
*** 3218,3225 
INIT(= N_("E1261: Cannot import .vim without using \"as\""));
  EXTERN char e_cannot_import_same_script_twice_str[]
INIT(= N_("E1262: Cannot import the same script twice: %s"));
! EXTERN char e_using_autoload_name_in_non_autoload_script_str[]
!   INIT(= N_("E1263: Using autoload name in a non-autoload script: %s"));
  EXTERN char e_autoload_import_cannot_use_absolute_or_relative_path[]
INIT(= N_("E1264: Autoload import cannot use absolute or relative path: 
%s"));
  EXTERN char e_cannot_use_partial_here[]
--- 3218,3225 
INIT(= N_("E1261: Cannot import .vim without using \"as\""));
  EXTERN char e_cannot_import_same_script_twice_str[]
INIT(= N_("E1262: Cannot import the same script twice: %s"));
! EXTERN char e_cannot_use_name_with_hash_in_vim9_script_use_export_instead[]
!   INIT(= N_("E1263: cannot use name with # in Vim9 script, use export 
instead"));
  EXTERN char e_autoload_import_cannot_use_absolute_or_relative_path[]
INIT(= N_("E1264: Autoload import cannot use absolute or relative path: 
%s"));
  EXTERN char e_cannot_use_partial_here[]
*** ../vim-8.2.4263/src/userfunc.c  2022-01-30 15:28:26.642295028 +
--- src/userfunc.c  2022-01-30 18:22:31.495602792 +
***
*** 4232,4237 
--- 4232,4242 
name = prefixed;
}
}
+   else if (vim9script && vim_strchr(name, AUTOLOAD_CHAR) != NULL)
+   {
+   
emsg(_(e_cannot_use_name_with_hash_in_vim9_script_use_export_instead));
+   goto ret_free;
+   }
  }
  
  // An error in a function call during evaluation of an expression in magic
***
*** 4540,4551 
}
}
}
-   else if (vim9script && vim_strchr(name, AUTOLOAD_CHAR) != NULL)
-   {
-   semsg(_(e_using_autoload_name_in_non_autoload_script_str),
-name);
-   goto erret;
-   }
}
if (var_conflict)
{
--- 4545,4550 
*** ../vim-8.2.4263/src/testdir/test_vim9_import.vim2022-01-30 
15:28:26.646294975 +
--- src/testdir/test_vim9_import.vim2022-01-30 18:26:22.964110620 +
***
*** 1614,1626 
  def Test_vim9_autoload_full_name()
var lines =<< trim END
   vim9script
!  def some#gettest(): string
 return 'test'
   enddef
   g:some#name = 'name'
   g:some#dict = {key: 'value'}
  
!  def some#varargs(a1: string, ...l: list): string
 return a1 .. l[0] .. l[1]
   enddef
END
--- 1614,1626 
  def Test_vim9_autoload_full_name()
var lines =<< trim END
   vim9script
!  export def Gettest(): string
 return 'test'
   enddef
   g:some#name = 'name'
   g:some#dict = {key: 'value'}
  
!  export def Varargs(a1: string, ...l: list): string
 return a1 .. l[0] .. l[1]
   enddef
END
***
*** 1630,1652 
var save_rtp = &rtp
exe 'set rtp^=' .. getcwd() .. '/Xdir'
  
!   assert_equal('test', g:some#gettest())
assert_equal('name', g:some#name)
assert_equal('value', g:some#dict.key)
g:some#other = 'other'
assert_equal('other', g:some#other)
  
!   assert_equal('abc', some#varargs('a', 'b', 'c'))
  
# upper case script name works
lines =<< trim END
   vim9script
!  def Other#getOther(): string
 return 'other'
   enddef
END
writefile(lines, 'Xdir/autoload/Other.vim')
!   assert_equal('other', g:Other#getOther())
  
delete('Xdir', 'rf')
&rtp = save_rtp
--- 1630,1652 
var save_rtp = &rtp
exe 'set rtp^=' .. getcwd() .. '/Xdir'
  
!   assert_equal('test', g:some#Gettest())
assert_equal('name', g:some#name)
assert_equal('value', g:some#dict.key)
g:some#other = 'other'
assert_equal('other', g:some#other)
  
!   assert_equal('abc', some#Varargs('a', 'b', 'c'))
  
# upper case script name works
lines =<< trim END
   vim9script
!  export def GetOther(): string
 return 'other'
   enddef
END
writefile(lines, 'Xdir/autoload/Other.vim')
!   assert_equal('other', g:Other#GetOther())
  
delete('Xdir', 'rf')
&rtp = save_rtp
***
*** 2020,2033 
  
  def Test_autoload_name_wrong()
var lines =<< trim END
-  vim9script
   def Xscriptname#Func()
   enddef
END
writefile(lines, 'Xscriptname.vim')
!   v9.CheckScriptFailure(lines,

Patch 8.2.4265

2022-01-30 Thread Bram Moolenaar


Patch 8.2.4265 (after 8.2.4264)
Problem:Autoload tests fails.
Solution:   Use export instead of name with #.
Files:  src/testdir/sautest/autoload/auto9.vim,
src/testdir/test_autoload.vim src/testdir/test_ins_complete.vim


*** ../vim-8.2.4264/src/testdir/sautest/autoload/auto9.vim  2020-07-29 
21:10:42.037708767 +0100
--- src/testdir/sautest/autoload/auto9.vim  2022-01-30 18:51:27.677586105 
+
***
*** 1,9 
  vim9script
  
! func auto9#getsome()
return 'some'
  endfunc
  
! def auto9#add42(count: number): number
return count + 42
  enddef
--- 1,9 
  vim9script
  
! export func Getsome()
return 'some'
  endfunc
  
! export def Add42(count: number): number
return count + 42
  enddef
*** ../vim-8.2.4264/src/testdir/test_autoload.vim   2022-01-21 
10:32:53.948494252 +
--- src/testdir/test_autoload.vim   2022-01-30 18:51:34.693481316 +
***
*** 22,29 
  endfunc
  
  func Test_autoload_vim9script()
!   call assert_equal('some', auto9#getsome())
!   call assert_equal(49, auto9#add42(7))
  endfunc
  
  
--- 22,29 
  endfunc
  
  func Test_autoload_vim9script()
!   call assert_equal('some', auto9#Getsome())
!   call assert_equal(49, auto9#Add42(7))
  endfunc
  
  
*** ../vim-8.2.4264/src/testdir/test_ins_complete.vim   2022-01-30 
15:28:26.646294975 +
--- src/testdir/test_ins_complete.vim   2022-01-30 18:54:16.175256556 +
***
*** 148,154 
  
let lines =<< trim END
vim9script
!   def omni#func(findstart: bool, base: string): any
if findstart
return 1
else
--- 148,154 
  
let lines =<< trim END
vim9script
!   export def Func(findstart: bool, base: string): any
if findstart
return 1
else
***
*** 162,168 
call writefile(lines, dir .. '/omni.vim')
  
new
!   setlocal omnifunc=omni#func
call feedkeys("i\\\", 'xt')
  
bwipe!
--- 162,168 
call writefile(lines, dir .. '/omni.vim')
  
new
!   setlocal omnifunc=omni#Func
call feedkeys("i\\\", 'xt')
  
bwipe!
*** ../vim-8.2.4264/src/version.c   2022-01-30 18:40:40.539255759 +
--- src/version.c   2022-01-30 18:55:01.294666909 +
***
*** 752,753 
--- 752,755 
  {   /* Add new patch number below this line */
+ /**/
+ 4265,
  /**/

-- 
OLD WOMAN: Well, how did you become king, then?
ARTHUR: The Lady of the Lake, her arm clad in the purest shimmering samite,
held Excalibur aloft from the bosom of the water to signify by Divine
Providence ...  that I, Arthur, was to carry Excalibur ...  That is
why I am your king!
 "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/20220130185708.EF4F21C1918%40moolenaar.net.


Re: Patch 8.2.4264

2022-01-30 Thread John Marriott


On 31-Jan-2022 05:41, Bram Moolenaar wrote:

Patch 8.2.4264
Problem:Vim9: can use old style autoload function name.
Solution:   Give an error for old style autoload function name.
Files:  src/errors.h, src/userfunc.c, src/testdir/test_vim9_import.vim,
 src/testdir/test_vim9_func.vim, src/testdir/test_vim9_script.vim




After this patch, mingw64 (gcc 11.2.0) throws 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 userfunc.c -o 
gobjnative/userfunc.o

userfunc.c: In function 'define_function':
userfunc.c:4833:14: warning: 'saved_did_emsg' may be used uninitialized 
in this function [-Wmaybe-uninitialized]

 4833 | did_emsg |= saved_did_emsg;
  |  ^~


The attached patch tries to fix it.

By the way, are we sure that line 4833 (did_emsg |= saved_did_emsg) is 
correct? Shouldn't it be: did_emsg = save_did_emsg?


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/a8bc2db2-75a1-50eb-db9f-b672562b1770%40internode.on.net.
--- userfunc.c.orig 2022-01-31 05:45:05.539685500 +1100
+++ userfunc.c  2022-01-31 06:09:47.930548300 +1100
@@ -4173,6 +4173,11 @@
 ga_init(&argtypes);
 ga_init(&default_args);
 
+// An error in a function call during evaluation of an expression in magic
+// braces should not cause the function not to be defined.
+saved_did_emsg = did_emsg;
+did_emsg = FALSE;
+
 /*
  * Get the function name.  There are these situations:
  * funcnormal function name
@@ -4239,11 +4244,6 @@
}
 }
 
-// An error in a function call during evaluation of an expression in magic
-// braces should not cause the function not to be defined.
-saved_did_emsg = did_emsg;
-did_emsg = FALSE;
-
 /*
  * ":function func" with only function name: list function.
  */


Patch 8.2.4266

2022-01-30 Thread Bram Moolenaar


Patch 8.2.4266
Problem:Compiler warning for uninitialized variable.
Solution:   Initialize saved_did_emsg.
Files:  src/userfunc.c


*** ../vim-8.2.4265/src/userfunc.c  2022-01-30 18:40:40.535255817 +
--- src/userfunc.c  2022-01-30 19:36:21.275573141 +
***
*** 4104,4110 
  {
  int   j;
  int   c;
! int   saved_did_emsg;
  char_u*name = name_arg;
  int   is_global = FALSE;
  char_u*p;
--- 4104,4110 
  {
  int   j;
  int   c;
! int   saved_did_emsg = FALSE;
  char_u*name = name_arg;
  int   is_global = FALSE;
  char_u*p;
*** ../vim-8.2.4265/src/version.c   2022-01-30 18:56:31.961463935 +
--- src/version.c   2022-01-30 19:37:26.958646384 +
***
*** 752,753 
--- 752,755 
  {   /* Add new patch number below this line */
+ /**/
+ 4266,
  /**/

-- 
Hanson's Treatment of Time:
There are never enough hours in a day, but always too
many days before Saturday.

 /// 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/20220130193834.2F41C1C1918%40moolenaar.net.


Re: Patch 8.2.4264

2022-01-30 Thread Bram Moolenaar


John Marriott wrote:

> On 31-Jan-2022 05:41, Bram Moolenaar wrote:
> > Patch 8.2.4264
> > Problem:Vim9: can use old style autoload function name.
> > Solution:   Give an error for old style autoload function name.
> > Files:  src/errors.h, src/userfunc.c, src/testdir/test_vim9_import.vim,
> >  src/testdir/test_vim9_func.vim, 
> > src/testdir/test_vim9_script.vim
> >
> >
> >
> After this patch, mingw64 (gcc 11.2.0) throws 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 userfunc.c -o 
> gobjnative/userfunc.o
> userfunc.c: In function 'define_function':
> userfunc.c:4833:14: warning: 'saved_did_emsg' may be used uninitialized 
> in this function [-Wmaybe-uninitialized]
>   4833 | did_emsg |= saved_did_emsg;
>    |  ^~
> 
> 
> The attached patch tries to fix it.

I saw your patch only after sending out patch 8.2.4266.  The effect
should be the same.

> By the way, are we sure that line 4833 (did_emsg |= saved_did_emsg) is 
> correct? Shouldn't it be: did_emsg = save_did_emsg?

We don't want to reset did_emsg here.  It's a corner case anyway, the
comment mentions "magic braces":

// An error in a function call during evaluation of an expression in magic
// braces should not cause the function not to be defined.

I'm not sure this is true, we usually abort when an error is detected.
But I don't like to change old behavior unless we know why it was done
that way.


-- 
DENNIS: You can't expect to wield supreme executive power just 'cause some
watery tart threw a sword at you!
 "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/20220130200141.5BC2E1C1918%40moolenaar.net.


Re: Patch 8.2.4264

2022-01-30 Thread John Marriott




On 31-Jan-2022 07:01, Bram Moolenaar wrote:


I saw your patch only after sending out patch 8.2.4266.  The effect
should be the same.


By the way, are we sure that line 4833 (did_emsg |= saved_did_emsg) is
correct? Shouldn't it be: did_emsg = save_did_emsg?

We don't want to reset did_emsg here.  It's a corner case anyway, the
comment mentions "magic braces":

 // An error in a function call during evaluation of an expression in magic
 // braces should not cause the function not to be defined.

I'm not sure this is true, we usually abort when an error is detected.
But I don't like to change old behavior unless we know why it was done
that way.



No worries.

--
--
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/04efd22b-5f10-b702-68bd-66515797d3ef%40internode.on.net.


Re: 11. B) Building with Ruby support x64 pb

2022-01-30 Thread Christian J. Robinson
It looks like you're using a 32bit compiler but trying to compile with a
64bit version of Ruby. Try using a 64bit compiler instead?

On Sat, Jan 29, 2022 at 1:31 PM Ni Va  wrote:

> It seems to be  C:\Ruby31-x64\include\ruby-3.1.0\x64-mingw-ucrt\ruby
> ...
>
> Le samedi 29 janvier 2022 à 21:27:38 UTC+1, Ni Va a écrit :
>
>> Hi,
>>
>> Trying to build last GVIM version with Ruby support in 64bits with mingw
>> I follow instructions as described in installPC.txt 11.B) but encounter
>> error of A) config.h.
>>
>>
>> [image: Capture.PNG]
>>
>> Surprised by appearence of i386...
>>
>> Thank you have idea
>> NiVa
>>
>>
>> = CONFIG =
>> Last Git Clone vim 8.2 patch 4256
>> OS Win10 64bits
>> MSYS2 64-bits
>> Flags
>> OLE=yes GUI=yes XPM=no DIRECTx=yes DYNAMIC_LUA=yes LUA=./lua-5.4.4/src
>> LUA_VER=54 PYTHON3=c:/Python310 DYNAMIC_PYTHON3=yes PYTHON3_VER=311
>> DYNAMIC_PYTHON3_DLL=python311.dll *RUBY=c:/Ruby31-x64 DYNAMIC_RUBY=yes
>> RUBY_VER=31 RUBY_API_VER_LONG=3.1.0 *TERMINAL=yes EVENT_LOOP=yes
>> STATIC_STDCPLUS=yes
>>
>> MAKE launched with mingw32-make -f Make_ming.mak ${FLAGS} DEBUG=no
>>
> --
> --
> 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/6d89da14-728d-464d-b598-0b44c34791bdn%40googlegroups.com
> 
> .
>


-- 
Christian J. Robinson 

-- 
-- 
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/CAK14FZ%2BHkYqHFhWuSpdXQ7-AK8YfVbRTkn7GS3XochY5mnHDOQ%40mail.gmail.com.