diff options
author | Bram Moolenaar <Bram@vim.org> | 2021-07-26 21:10:11 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-07-26 21:10:11 +0200 |
commit | 678b207fb111840fec1f0dc43910613ba106b90d (patch) | |
tree | c897c4e8f66da66dac4c1dec63b677038b48b19e /src | |
parent | ff34bee3a2d22f2ff7abd4519270b5518082c33d (diff) | |
download | vim-git-678b207fb111840fec1f0dc43910613ba106b90d.tar.gz |
patch 8.2.3224: cannot call script-local function after :vim9cmdv8.2.3224
Problem: Cannot call script-local function after :vim9cmd. (Christian J.
Robinson)
Solution: Skip over "<SNR>123".
Diffstat (limited to 'src')
-rw-r--r-- | src/eval.c | 3 | ||||
-rw-r--r-- | src/testdir/test_vim9_cmd.vim | 14 | ||||
-rw-r--r-- | src/version.c | 2 | ||||
-rw-r--r-- | src/vim9compile.c | 6 |
4 files changed, 23 insertions, 2 deletions
diff --git a/src/eval.c b/src/eval.c index fc2266225..8050bbbbe 100644 --- a/src/eval.c +++ b/src/eval.c @@ -3326,7 +3326,8 @@ eval7t( : (evalarg->eval_flags & EVAL_EVALUATE); // Recognize <type> in Vim9 script only. - if (in_vim9script() && **arg == '<' && eval_isnamec1((*arg)[1])) + if (in_vim9script() && **arg == '<' && eval_isnamec1((*arg)[1]) + && STRNCMP(*arg, "<SNR>", 5) != 0) { ++*arg; ga_init2(&type_list, sizeof(type_T *), 10); diff --git a/src/testdir/test_vim9_cmd.vim b/src/testdir/test_vim9_cmd.vim index 23c5cfacf..e6554e968 100644 --- a/src/testdir/test_vim9_cmd.vim +++ b/src/testdir/test_vim9_cmd.vim @@ -14,6 +14,20 @@ def Test_vim9cmd() END CheckScriptSuccess(lines) assert_fails('vim9cmd', 'E1164:') + + lines =<< trim END + vim9script + def Foo() + g:found_bar = "bar" + enddef + nmap ,; :vim9cmd <SID>Foo()<CR> + END + CheckScriptSuccess(lines) + feedkeys(',;', 'xt') + assert_equal("bar", g:found_bar) + + nunmap ,; + unlet g:found_bar enddef def Test_edit_wildcards() diff --git a/src/version.c b/src/version.c index 0f181efdf..190059e14 100644 --- a/src/version.c +++ b/src/version.c @@ -756,6 +756,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 3224, +/**/ 3223, /**/ 3222, diff --git a/src/vim9compile.c b/src/vim9compile.c index 62d73733b..7d169f8c2 100644 --- a/src/vim9compile.c +++ b/src/vim9compile.c @@ -3562,14 +3562,18 @@ to_name_end(char_u *arg, int use_namespace) /* * Like to_name_end() but also skip over a list or dict constant. + * Also accept "<SNR>123_Func". * This intentionally does not handle line continuation. */ char_u * to_name_const_end(char_u *arg) { - char_u *p = to_name_end(arg, TRUE); + char_u *p = arg; typval_T rettv; + if (STRNCMP(p, "<SNR>", 5) == 0) + p = skipdigits(p + 5); + p = to_name_end(p, TRUE); if (p == arg && *arg == '[') { |