Patch 8.2.4584 (after 8.2.4578)
Problem: Error for using autoload function in custom completion.
Solution: Do not check for errors when using an autoload function.
(closes #9962)
Files: src/eval.c, src/testdir/test_cmdline.vim
*** ../vim-8.2.4583/src/eval.c 2022-03-16 20:01:10.429458496 +0000
--- src/eval.c 2022-03-17 11:45:42.283807808 +0000
***************
*** 705,714 ****
// The name might be "import.Func" or "Funcref". We don't know, we need to
// ignore errors for an undefined name. But we do want errors when an
! // autoload script has errors. Guess that when there is a dot or '#' in
! // the name showing errors is the right choice.
! ignore_errors = vim_strchr(func, '.') == NULL
! && vim_strchr(func, AUTOLOAD_CHAR) == NULL;
arg = func;
if (ignore_errors)
++emsg_off;
--- 705,713 ----
// The name might be "import.Func" or "Funcref". We don't know, we need to
// ignore errors for an undefined name. But we do want errors when an
! // autoload script has errors. Guess that when there is a dot in the name
! // showing errors is the right choice.
! ignore_errors = vim_strchr(func, '.') == NULL;
arg = func;
if (ignore_errors)
++emsg_off;
*** ../vim-8.2.4583/src/testdir/test_cmdline.vim 2022-03-16 13:33:22.078467971 +0000
--- src/testdir/test_cmdline.vim 2022-03-17 11:44:18.063757006 +0000
***************
*** 1829,1834 ****
--- 1829,1857 ----
let &encoding = save_encoding
endfunc
+ func Test_custom_complete_autoload()
+ call mkdir('Xdir/autoload', 'p')
+ let save_rtp = &rtp
+ exe 'set rtp=' .. getcwd() .. '/Xdir'
+ let lines =<< trim END
+ func vim8#Complete(a, c, p)
+ return "oneA\noneB\noneC"
+ endfunc
+ END
+ call writefile(lines, 'Xdir/autoload/vim8.vim')
+
+ command -nargs=1 -complete=custom,vim8#Complete MyCmd
+ set nowildmenu
+ set wildmode=full,list
+ call feedkeys(":MyCmd \<C-A>\<C-B>\"\<CR>", 'xt')
+ call assert_equal('"MyCmd oneA oneB oneC', @:)
+
+ let &rtp = save_rtp
+ set wildmode& wildmenu&
+ delcommand MyCmd
+ call delete('Xdir', 'rf')
+ endfunc
+
" Test for interrupting the command-line completion
func Test_interrupt_compl()
func F(lead, cmdl, p)
*** ../vim-8.2.4583/src/version.c 2022-03-16 20:25:59.832818058 +0000
--- src/version.c 2022-03-17 11:46:17.287817120 +0000
***************
*** 752,753 ****
--- 752,755 ----
{ /* Add new patch number below this line */
+ /**/
+ 4584,
/**/
--
press CTRL-ALT-DEL for more information
/// Bram Moolenaar -- Br...@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 ///