diff options
author | Bram Moolenaar <Bram@vim.org> | 2020-12-25 19:47:24 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2020-12-25 19:47:24 +0100 |
commit | 20a762987eaa7e6034e9f75df0eb87eedb85d71f (patch) | |
tree | bd7ce5c79ce9411d96c211179ed8b40ae15cee3e | |
parent | 6e2c2c50bada4e3f5c7234902c0bdd64f66619ac (diff) | |
download | vim-git-20a762987eaa7e6034e9f75df0eb87eedb85d71f.tar.gz |
patch 8.2.2217: Vim9: command modifiers not restored in catch blockv8.2.2217
Problem: Vim9: command modifiers not restored in catch block.
Solution: Restore command modifiers. (closes #7542)
-rw-r--r-- | src/testdir/test_vim9_cmd.vim | 7 | ||||
-rw-r--r-- | src/version.c | 2 | ||||
-rw-r--r-- | src/vim9execute.c | 7 |
3 files changed, 16 insertions, 0 deletions
diff --git a/src/testdir/test_vim9_cmd.vim b/src/testdir/test_vim9_cmd.vim index a55ba6403..f5619b488 100644 --- a/src/testdir/test_vim9_cmd.vim +++ b/src/testdir/test_vim9_cmd.vim @@ -546,6 +546,13 @@ def Test_modifier_silent_unsilent() silent EchoThere() assert_equal("\nthere", execute(':1messages')) + + try + silent eval [][0] + catch + echomsg "caught" + endtry + assert_equal("\ncaught", execute(':1messages')) enddef def Test_range_after_command_modifier() diff --git a/src/version.c b/src/version.c index 6f30739b7..f48c2afd3 100644 --- a/src/version.c +++ b/src/version.c @@ -751,6 +751,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 2217, +/**/ 2216, /**/ 2215, diff --git a/src/vim9execute.c b/src/vim9execute.c index 415059256..4d8899167 100644 --- a/src/vim9execute.c +++ b/src/vim9execute.c @@ -2286,6 +2286,13 @@ call_def_function( { garray_T *trystack = &ectx.ec_trystack; + if (restore_cmdmod) + { + cmdmod.cmod_filter_regmatch.regprog = NULL; + undo_cmdmod(&cmdmod); + cmdmod = save_cmdmod; + restore_cmdmod = FALSE; + } if (trystack->ga_len > 0) { trycmd_T *trycmd = ((trycmd_T *)trystack->ga_data) |