Skip to content

Commit

Permalink
patch 8.2.1376: Vim9: expression mapping causes error for using :import
Browse files Browse the repository at this point in the history
Problem:    Vim9: expression mapping causes error for using :import.
Solution:   Add EX_LOCK_OK to :import and :export. (closes 3606)
  • Loading branch information
brammool committed Aug 5, 2020
1 parent c5da1fb commit 803af68
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/ex_cmds.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
30 changes: 30 additions & 0 deletions src/testdir/test_vim9_script.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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:')
Expand Down
2 changes: 2 additions & 0 deletions src/version.c
Original file line number Diff line number Diff line change
Expand Up @@ -754,6 +754,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
/**/
1376,
/**/
1375,
/**/
Expand Down

0 comments on commit 803af68

Please sign in to comment.