]> granicus.if.org Git - vim/commitdiff
patch 8.2.2217: Vim9: command modifiers not restored in catch block v8.2.2217
authorBram Moolenaar <Bram@vim.org>
Fri, 25 Dec 2020 18:47:24 +0000 (19:47 +0100)
committerBram Moolenaar <Bram@vim.org>
Fri, 25 Dec 2020 18:47:24 +0000 (19:47 +0100)
Problem:    Vim9: command modifiers not restored in catch block.
Solution:   Restore command modifiers. (closes #7542)

src/testdir/test_vim9_cmd.vim
src/version.c
src/vim9execute.c

index a55ba64031e1fc43a474641ed4e8e366e5a5a4c4..f5619b488d1ec1a49b44bb3d50034a877e90f3e3 100644 (file)
@@ -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()
index 6f30739b74c6c9a9adf30302c868a286621ca7c8..f48c2afd3cbf4d03cf401c292c0b9f7c1d3e7bd1 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2217,
 /**/
     2216,
 /**/
index 41505925680a5441ba3829f4542583841799c27b..4d889916763d3fee22754d2855fc443ebb8c4640 100644 (file)
@@ -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)