summaryrefslogtreecommitdiff
path: root/data/vim/patches/8.1.1345
diff options
context:
space:
mode:
Diffstat (limited to 'data/vim/patches/8.1.1345')
-rw-r--r--data/vim/patches/8.1.1345116
1 files changed, 116 insertions, 0 deletions
diff --git a/data/vim/patches/8.1.1345 b/data/vim/patches/8.1.1345
new file mode 100644
index 000000000..23746d0f1
--- /dev/null
+++ b/data/vim/patches/8.1.1345
@@ -0,0 +1,116 @@
+To: vim_dev@googlegroups.com
+Subject: Patch 8.1.1345
+Fcc: outbox
+From: Bram Moolenaar <Bram@moolenaar.net>
+Mime-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+------------
+
+Patch 8.1.1345
+Problem: Stuck in sandbox with ":s/../\=Function/gn".
+Solution: Don't skip over code to restore sandbox. (Christian Brabandt)
+Files: src/ex_cmds.c, src/testdir/test_substitute.vim
+
+
+*** ../vim-8.1.1344/src/ex_cmds.c 2019-05-15 22:45:33.956067651 +0200
+--- src/ex_cmds.c 2019-05-18 13:39:18.862210027 +0200
+***************
+*** 5555,5582 ****
+ #ifdef FEAT_EVAL
+ if (subflags.do_count)
+ {
+! /* prevent accidentally changing the buffer by a function */
+! save_ma = curbuf->b_p_ma;
+ curbuf->b_p_ma = FALSE;
+ sandbox++;
+ }
+! /* Save flags for recursion. They can change for e.g.
+! * :s/^/\=execute("s#^##gn") */
+ subflags_save = subflags;
+ #endif
+! /* get length of substitution part */
+ sublen = vim_regsub_multi(&regmatch,
+ sub_firstlnum - regmatch.startpos[0].lnum,
+ sub, sub_firstline, FALSE, p_magic, TRUE);
+ #ifdef FEAT_EVAL
+ // If getting the substitute string caused an error, don't do
+ // the replacement.
+- if (aborting())
+- goto skip;
+-
+ // Don't keep flags set by a recursive call.
+ subflags = subflags_save;
+! if (subflags.do_count)
+ {
+ curbuf->b_p_ma = save_ma;
+ if (sandbox > 0)
+--- 5555,5579 ----
+ #ifdef FEAT_EVAL
+ if (subflags.do_count)
+ {
+! // prevent accidentally changing the buffer by a function
+ curbuf->b_p_ma = FALSE;
+ sandbox++;
+ }
+! // Save flags for recursion. They can change for e.g.
+! // :s/^/\=execute("s#^##gn")
+ subflags_save = subflags;
++ save_ma = curbuf->b_p_ma;
+ #endif
+! // get length of substitution part
+ sublen = vim_regsub_multi(&regmatch,
+ sub_firstlnum - regmatch.startpos[0].lnum,
+ sub, sub_firstline, FALSE, p_magic, TRUE);
+ #ifdef FEAT_EVAL
+ // If getting the substitute string caused an error, don't do
+ // the replacement.
+ // Don't keep flags set by a recursive call.
+ subflags = subflags_save;
+! if (aborting() || subflags.do_count)
+ {
+ curbuf->b_p_ma = save_ma;
+ if (sandbox > 0)
+*** ../vim-8.1.1344/src/testdir/test_substitute.vim 2019-04-27 18:00:29.851064563 +0200
+--- src/testdir/test_substitute.vim 2019-05-18 13:35:12.383650094 +0200
+***************
+*** 638,643 ****
+--- 638,654 ----
+ 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
+
+*** ../vim-8.1.1344/src/version.c 2019-05-18 13:05:12.470334000 +0200
+--- src/version.c 2019-05-18 13:40:32.629781025 +0200
+***************
+*** 769,770 ****
+--- 769,772 ----
+ { /* Add new patch number below this line */
++ /**/
++ 1345,
+ /**/
+
+--
+For large projects, Team Leaders use sophisticated project management software
+to keep track of who's doing what. The software collects the lies and guesses
+of the project team and organizes them in to instantly outdated charts that
+are too boring to look at closely. This is called "planning".
+ (Scott Adams - The Dilbert principle)
+
+ /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
+/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
+\\\ an exciting new programming language -- http://www.Zimbu.org ///
+ \\\ help me help AIDS victims -- http://ICCF-Holland.org ///