Mercurial > vim
diff src/userfunc.c @ 27189:a10936038ec9 v8.2.4123
patch 8.2.4123: complete function cannot be import.Name
Commit: https://github.com/vim/vim/commit/15d1635e50896002fbd4ebbc896b78a155b2487d
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Jan 17 20:09:08 2022 +0000
patch 8.2.4123: complete function cannot be import.Name
Problem: Complete function cannot be import.Name.
Solution: Dereference the function name if needed. Also: do not see
"import.Name" as a builtin function. (closes #9541)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 17 Jan 2022 21:15:02 +0100 |
parents | 374c7d5a096a |
children | 73232ed49cf2 |
line wrap: on
line diff
--- a/src/userfunc.c +++ b/src/userfunc.c @@ -3119,18 +3119,30 @@ free_all_functions(void) /* * Return TRUE if "name" looks like a builtin function name: starts with a - * lower case letter and doesn't contain AUTOLOAD_CHAR or ':'. + * lower case letter, doesn't contain AUTOLOAD_CHAR or ':', no "." after the + * name. * "len" is the length of "name", or -1 for NUL terminated. */ int builtin_function(char_u *name, int len) { - char_u *p; + int i; if (!ASCII_ISLOWER(name[0]) || name[1] == ':') return FALSE; - p = vim_strchr(name, AUTOLOAD_CHAR); - return p == NULL || (len > 0 && p > name + len); + for (i = 0; name[i] != NUL && (len < 0 || i < len); ++i) + { + if (name[i] == AUTOLOAD_CHAR) + return FALSE; + if (!eval_isnamec(name[i])) + { + // "name.something" is not a builtin function + if (name[i] == '.') + return FALSE; + break; + } + } + return TRUE; } int