summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-07-25 19:30:59 +0200
committerBram Moolenaar <Bram@vim.org>2020-07-25 19:30:59 +0200
commit2d6b20d6a9a034b39f79a7dbb889fb5d859583ae (patch)
treebd5dda39ebe25457bec012aa476c3011cd68211c
parent2afc3b4f776a4fe2bb22d0a79e77012d79b4ec1e (diff)
patch 8.2.1293: Vim9: error when using vim9script in TextYankPostv8.2.1293
Problem: Vim9: error when using vim9script in TextYankPost. Solution: Use EX_LOCKOK instead of the EX_CMDWIN flag for command that can be used when text is locked. (closes #6529)
-rw-r--r--src/testdir/test_vim9_script.vim30
-rw-r--r--src/version.c2
-rw-r--r--src/vim9compile.c4
3 files changed, 35 insertions, 1 deletions
diff --git a/src/testdir/test_vim9_script.vim b/src/testdir/test_vim9_script.vim
index f7d195ea83..ac76e8d5bc 100644
--- a/src/testdir/test_vim9_script.vim
+++ b/src/testdir/test_vim9_script.vim
@@ -1708,6 +1708,10 @@ def Test_execute_cmd()
assert_equal('execute-var-var', getline(1))
bwipe!
+ let n = true
+ execute 'echomsg' (n ? '"true"' : '"no"')
+ assert_match('^true$', Screenline(&lines))
+
call CheckDefFailure(['execute xxx'], 'E1001:')
call CheckDefFailure(['execute "cmd"# comment'], 'E488:')
enddef
@@ -2634,6 +2638,32 @@ def Test_vim9_copen()
quit
enddef
+" test using a vim9script that is auto-loaded from an autocmd
+def Test_vim9_autoload()
+ let lines =<< trim END
+ vim9script
+ def foo#test()
+ echomsg getreg('"')
+ enddef
+ END
+
+ mkdir('Xdir/autoload', 'p')
+ writefile(lines, 'Xdir/autoload/foo.vim')
+ let save_rtp = &rtp
+ exe 'set rtp^=' .. getcwd() .. '/Xdir'
+ augroup test
+ autocmd TextYankPost * call foo#test()
+ augroup END
+
+ normal Y
+
+ augroup test
+ autocmd!
+ augroup END
+ delete('Xdir', 'rf')
+ &rtp = save_rtp
+enddef
+
" Keep this last, it messes up highlighting.
def Test_substitute_cmd()
new
diff --git a/src/version.c b/src/version.c
index 3611fe6a4b..05f37526d4 100644
--- a/src/version.c
+++ b/src/version.c
@@ -755,6 +755,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1293,
+/**/
1292,
/**/
1291,
diff --git a/src/vim9compile.c b/src/vim9compile.c
index 53bfb6c48e..746c9aa1a2 100644
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -3755,7 +3755,9 @@ compile_subscript(
}
}
- if (*p == '(')
+ // Do not skip over white space to find the "(", "exeucte 'x' ()" is
+ // not a function call.
+ if (**arg == '(')
{
garray_T *stack = &cctx->ctx_type_stack;
type_T *type;