diff options
author | Bram Moolenaar <Bram@vim.org> | 2020-08-05 16:20:03 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2020-08-05 16:20:03 +0200 |
commit | 803af686e23c7bb17273bb0c78ff0bf97e8d23f4 (patch) | |
tree | f60e12497c9aacaa99c37aeeeeb56caa09fe079b /src | |
parent | c5da1fb7ea4126b6c70426cf0add51e720b7cd3f (diff) |
patch 8.2.1376: Vim9: expression mapping causes error for using :importv8.2.1376
Problem: Vim9: expression mapping causes error for using :import.
Solution: Add EX_LOCK_OK to :import and :export. (closes 3606)
Diffstat (limited to 'src')
-rw-r--r-- | src/ex_cmds.h | 4 | ||||
-rw-r--r-- | src/testdir/test_vim9_script.vim | 30 | ||||
-rw-r--r-- | src/version.c | 2 |
3 files changed, 34 insertions, 2 deletions
diff --git a/src/ex_cmds.h b/src/ex_cmds.h index 9ae85f0f31..c65b956ee4 100644 --- a/src/ex_cmds.h +++ b/src/ex_cmds.h @@ -572,7 +572,7 @@ EXCMD(CMD_exit, "exit", ex_exit, EX_RANGE|EX_WHOLEFOLD|EX_BANG|EX_FILE1|EX_ARGOPT|EX_DFLALL|EX_TRLBAR|EX_CMDWIN|EX_LOCK_OK, ADDR_LINES), EXCMD(CMD_export, "export", ex_export, - EX_EXTRA|EX_NOTRLCOM, + EX_EXTRA|EX_NOTRLCOM|EX_LOCK_OK, ADDR_NONE), EXCMD(CMD_exusage, "exusage", ex_exusage, EX_TRLBAR, @@ -698,7 +698,7 @@ EXCMD(CMD_imenu, "imenu", ex_menu, EX_RANGE|EX_ZEROR|EX_EXTRA|EX_TRLBAR|EX_NOTRLCOM|EX_CTRLV|EX_CMDWIN|EX_LOCK_OK, ADDR_OTHER), EXCMD(CMD_import, "import", ex_import, - EX_EXTRA|EX_NOTRLCOM, + EX_EXTRA|EX_NOTRLCOM|EX_LOCK_OK, ADDR_NONE), EXCMD(CMD_inoremap, "inoremap", ex_map, EX_EXTRA|EX_TRLBAR|EX_NOTRLCOM|EX_CTRLV|EX_CMDWIN|EX_LOCK_OK, diff --git a/src/testdir/test_vim9_script.vim b/src/testdir/test_vim9_script.vim index c50a0d337a..b05cd54ebb 100644 --- a/src/testdir/test_vim9_script.vim +++ b/src/testdir/test_vim9_script.vim @@ -1351,6 +1351,36 @@ def Test_vim9_import_export() delete('Xvim9_script') enddef +func g:Trigger() + source Ximport.vim + return "echo 'yes'\<CR>" +endfunc + +def Test_import_export_expr_map() + # check that :import and :export work when buffer is locked + let export_lines =<< trim END + vim9script + export def That(): string + return 'yes' + enddef + END + writefile(export_lines, 'Xexport_that.vim') + + let import_lines =<< trim END + vim9script + import That from './Xexport_that.vim' + assert_equal('yes', That()) + END + writefile(import_lines, 'Ximport.vim') + + nnoremap <expr> trigger g:Trigger() + feedkeys('trigger', "xt") + + delete('Xexport.vim') + delete('Ximport.vim') + nunmap trigger +enddef + def Test_vim9script_fails() CheckScriptFailure(['scriptversion 2', 'vim9script'], 'E1039:') CheckScriptFailure(['vim9script', 'scriptversion 2'], 'E1040:') diff --git a/src/version.c b/src/version.c index 8bc928206d..53e47bf7f7 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 */ /**/ + 1376, +/**/ 1375, /**/ 1374, |