patch 8.1.1345: stuck in sandbox with ":s/../\=Function/gn"
Problem: Stuck in sandbox with ":s/../\=Function/gn".
Solution: Don't skip over code to restore sandbox. (Christian Brabandt)
diff --git a/src/testdir/test_substitute.vim b/src/testdir/test_substitute.vim
index a58b56e..06bdc24 100644
--- a/src/testdir/test_substitute.vim
+++ b/src/testdir/test_substitute.vim
@@ -638,6 +638,17 @@
call assert_equal(1, error_caught)
call assert_equal(['1 aaa', '2 aaa', '3 aaa'], getline(1, 3))
+ " Same, but using "n" flag so that "sandbox" gets set
+ call setline(1, ['1 aaa', '2 aaa', '3 aaa'])
+ let error_caught = 0
+ try
+ %s/aaa/\=Foo()/gn
+ catch
+ let error_caught = 1
+ endtry
+ call assert_equal(1, error_caught)
+ call assert_equal(['1 aaa', '2 aaa', '3 aaa'], getline(1, 3))
+
bwipe!
endfunc