vim-patch:9.1.1603: completion: cannot use autoloaded funcs in 'complete' F{func}

Problem:  completion: cannot use autoloaded funcs in 'complete' F{func}
          (Maxim Kim)
Solution: Make it work (Girish Palya)

fixes: vim/vim#17869
closes: vim/vim#17885

1bfe86a7d3

Cherry-pick Test_omni_autoload() from patch 8.2.3223.

Co-authored-by: Girish Palya <girishji@gmail.com>
This commit is contained in:
zeertzjq
2025-08-09 09:48:30 +08:00
parent 1968029003
commit b1e35cbd7b
8 changed files with 282 additions and 48 deletions

View File

@@ -118,6 +118,15 @@ char *illegal_char(char *errbuf, size_t errbuflen, int c)
return errbuf;
}
static char *illegal_char_after_chr(char *errbuf, size_t errbuflen, int c)
{
if (errbuf == NULL) {
return "";
}
vim_snprintf(errbuf, errbuflen, _(e_illegal_character_after_chr), c);
return errbuf;
}
/// Check string options in a buffer for NULL value.
void check_buf_options(buf_T *buf)
{
@@ -902,9 +911,8 @@ const char *did_set_complete(optset_T *args)
}
if (char_before != NUL) {
if (args->os_errbuf != NULL) {
vim_snprintf(args->os_errbuf, args->os_errbuflen,
_(e_illegal_character_after_chr), char_before);
return args->os_errbuf;
return illegal_char_after_chr(args->os_errbuf, args->os_errbuflen,
char_before);
}
return NULL;
}
@@ -913,6 +921,10 @@ const char *did_set_complete(optset_T *args)
p++;
}
}
if (set_cpt_callbacks(args) != OK) {
return illegal_char_after_chr(args->os_errbuf, args->os_errbuflen, 'F');
}
return NULL;
}