patch 8.2.2386: Vim9: crash when using ":silent! put"
Problem: Vim9: crash when using ":silent! put".
Solution: When ignoring an error for ":silent!" rewind the stack and skip
ahead to restoring the cmdmod. (closes #7717)
diff --git a/src/testdir/test_vim9_func.vim b/src/testdir/test_vim9_func.vim
index 1ea8ac9..da0a0e6 100644
--- a/src/testdir/test_vim9_func.vim
+++ b/src/testdir/test_vim9_func.vim
@@ -2184,6 +2184,24 @@
CheckScriptSuccess(lines)
enddef
+def Test_skip_cmds_with_silent()
+ var lines =<< trim END
+ vim9script
+
+ def Func(b: bool)
+ Crash()
+ enddef
+
+ def Crash()
+ sil! :/not found/d _
+ sil! :/not found/put _
+ enddef
+
+ Func(true)
+ END
+ CheckScriptSuccess(lines)
+enddef
+
def Test_opfunc()
nnoremap <F3> <cmd>set opfunc=Opfunc<cr>g@
def g:Opfunc(_: any): string