changeset 23348:456d625bb8c1 v8.2.2217

patch 8.2.2217: Vim9: command modifiers not restored in catch block Commit: https://github.com/vim/vim/commit/20a762987eaa7e6034e9f75df0eb87eedb85d71f Author: Bram Moolenaar <Bram@vim.org> Date: Fri Dec 25 19:47:24 2020 +0100 patch 8.2.2217: Vim9: command modifiers not restored in catch block Problem: Vim9: command modifiers not restored in catch block. Solution: Restore command modifiers. (closes https://github.com/vim/vim/issues/7542)
author Bram Moolenaar <Bram@vim.org>
date Fri, 25 Dec 2020 20:00:03 +0100
parents e4c816576c42
children 1d0b46988d16
files src/testdir/test_vim9_cmd.vim src/version.c src/vim9execute.c
diffstat 3 files changed, 16 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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()
--- 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,
--- 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)