diff options
author | Bram Moolenaar <Bram@vim.org> | 2022-04-14 12:58:23 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-04-14 12:58:23 +0100 |
commit | 8944551534b311a2d25acf6e8db235c6d906256c (patch) | |
tree | efcd900fc101768e456d5124ca1d5b2f7d064920 /src/scriptfile.c | |
parent | f420ff2440a009acd9573fdb6ad6d53509d78009 (diff) |
patch 8.2.4748: cannot use an imported function in a mappingv8.2.4748
Problem: Cannot use an imported function in a mapping.
Solution: Recognize <SID>name.Func.
Diffstat (limited to 'src/scriptfile.c')
-rw-r--r-- | src/scriptfile.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/scriptfile.c b/src/scriptfile.c index 7e14cdc6e3..2a1f84a50e 100644 --- a/src/scriptfile.c +++ b/src/scriptfile.c @@ -117,7 +117,7 @@ estack_pop(void) } /* - * Get the current value for <sfile> in allocated memory. + * Get the current value for "which" in allocated memory. * "which" is ESTACK_SFILE for <sfile>, ESTACK_STACK for <stack> or * ESTACK_SCRIPT for <script>. */ @@ -2468,6 +2468,18 @@ script_autoload( int i; int ret_sid; + // If the name starts with "<SNR>123_" then "123" is the script ID. + if (name[0] == K_SPECIAL && name[1] == KS_EXTRA && name[2] == KE_SNR) + { + p = name + 3; + ret_sid = (int)getdigits(&p); + if (*p == '_' && SCRIPT_ID_VALID(ret_sid)) + { + may_load_script(ret_sid, &ret); + return ret; + } + } + // If there is no '#' after name[0] there is no package name. p = vim_strchr(name, AUTOLOAD_CHAR); if (p == NULL || p == name) |