]> granicus.if.org Git - vim/commitdiff
patch 8.2.4584: error for using autoload function in custom completion v8.2.4584
authorBram Moolenaar <Bram@vim.org>
Thu, 17 Mar 2022 11:46:55 +0000 (11:46 +0000)
committerBram Moolenaar <Bram@vim.org>
Thu, 17 Mar 2022 11:46:55 +0000 (11:46 +0000)
Problem:    Error for using autoload function in custom completion.
Solution:   Do not check for errors when using an autoload function.
            (closes #9962)

src/eval.c
src/testdir/test_cmdline.vim
src/version.c

index e4f47b18bd345990772c3ee8a49a0846dd3f227e..3f6be184797418920fba046efad8ea8f94fb2841 100644 (file)
@@ -705,10 +705,9 @@ call_vim_function(
 
     // 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;
+    // 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;
index ba3c50878fb11443f75e2da639c02653d24ec969..c3a6425b877a1ef8a5263c5c1d51491cba586825 100644 (file)
@@ -1829,6 +1829,29 @@ func Test_wildmode()
   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)
index 4b5088cf65eadc9a3574da51a9548a696ebd795c..b9ec937e87b05007b52f89e06f3b7d07bfe2a4d8 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    4584,
 /**/
     4583,
 /**/