summaryrefslogtreecommitdiff
path: root/data/vim/patches/8.1.1061
diff options
context:
space:
mode:
Diffstat (limited to 'data/vim/patches/8.1.1061')
-rw-r--r--data/vim/patches/8.1.1061101
1 files changed, 101 insertions, 0 deletions
diff --git a/data/vim/patches/8.1.1061 b/data/vim/patches/8.1.1061
new file mode 100644
index 000000000..c82656821
--- /dev/null
+++ b/data/vim/patches/8.1.1061
@@ -0,0 +1,101 @@
+To: vim_dev@googlegroups.com
+Subject: Patch 8.1.1061
+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.1061
+Problem: When substitute string throws error, substitute happens anyway.
+Solution: Skip substitution when aborting. (closes #4161)
+Files: src/ex_cmds.c, src/testdir/test_substitute.vim
+
+
+*** ../vim-8.1.1060/src/ex_cmds.c 2019-03-17 16:59:38.582201903 +0100
+--- src/ex_cmds.c 2019-03-24 22:26:56.525595616 +0100
+***************
+*** 5574,5580 ****
+ sub_firstlnum - regmatch.startpos[0].lnum,
+ sub, sub_firstline, FALSE, p_magic, TRUE);
+ #ifdef FEAT_EVAL
+! /* Don't keep flags set by a recursive call. */
+ subflags = subflags_save;
+ if (subflags.do_count)
+ {
+--- 5574,5585 ----
+ 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)
+ {
+*** ../vim-8.1.1060/src/testdir/test_substitute.vim 2019-02-10 22:50:08.011856775 +0100
+--- src/testdir/test_substitute.vim 2019-03-27 22:33:23.761578469 +0100
+***************
+*** 610,612 ****
+--- 610,642 ----
+ enew!
+ set titlestring&
+ endfunc
++
++ func Test_nocatch_sub_failure_handling()
++ " normal error results in all replacements
++ func! Foo()
++ foobar
++ endfunc
++ new
++ call setline(1, ['1 aaa', '2 aaa', '3 aaa'])
++ %s/aaa/\=Foo()/g
++ call assert_equal(['1 0', '2 0', '3 0'], getline(1, 3))
++
++ " Trow without try-catch causes abort after the first line.
++ " We cannot test this, since it would stop executing the test script.
++
++ " try/catch does not result in any changes
++ func! Foo()
++ throw 'error'
++ endfunc
++ call setline(1, ['1 aaa', '2 aaa', '3 aaa'])
++ let error_caught = 0
++ try
++ %s/aaa/\=Foo()/g
++ 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.1060/src/version.c 2019-03-27 21:59:40.903552946 +0100
+--- src/version.c 2019-03-27 22:34:08.561183332 +0100
+***************
+*** 777,778 ****
+--- 777,780 ----
+ { /* Add new patch number below this line */
++ /**/
++ 1061,
+ /**/
+
+--
+"The sun oozed over the horizon, shoved aside darkness, crept along the
+greensward, and, with sickly fingers, pushed through the castle window,
+revealing the pillaged princess, hand at throat, crown asunder, gaping
+in frenzied horror at the sated, sodden amphibian lying beside her,
+disbelieving the magnitude of the frog's deception, screaming madly,
+"You lied!"
+ - Winner of the Bulwer-Lytton contest (San Jose State University),
+ wherein one writes only the first line of a bad novel
+
+ /// 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 ///