Patch 8.1.1360 (after Patch 8.1.1345)
Problem: Buffer left 'nomodifiable' after :substitute. (Ingo Karkat)
Solution: Save the value of 'modifiable' earlier' (Christian Brabandt,
closes #4403)
Files: src/ex_cmds.c, src/testdir/test_substitute.vim
*** ../vim-8.1.1359/src/ex_cmds.c 2019-05-19 22:53:36.504914607 +0200
--- src/ex_cmds.c 2019-05-20 20:32:22.828513580 +0200
***************
*** 5557,5562 ****
--- 5557,5563 ----
* 3. substitute the string.
*/
#ifdef FEAT_EVAL
+ save_ma = curbuf->b_p_ma;
if (subflags.do_count)
{
// prevent accidentally changing the buffer by a function
***************
*** 5566,5572 ****
// 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(®match,
--- 5567,5572 ----
*** ../vim-8.1.1359/src/testdir/test_substitute.vim 2019-05-18
13:41:19.061511348 +0200
--- src/testdir/test_substitute.vim 2019-05-20 20:31:52.408660842 +0200
***************
*** 611,619 ****
set titlestring&
endfunc
func Test_nocatch_sub_failure_handling()
" normal error results in all replacements
! func! Foo()
foobar
endfunc
new
--- 611,634 ----
set titlestring&
endfunc
+ func Test_sub_cmd_9()
+ new
+ let input = ['1 aaa', '2 aaa', '3 aaa']
+ call setline(1, input)
+ func Foo()
+ return submatch(0)
+ endfunc
+ %s/aaa/\=Foo()/gn
+ call assert_equal(input, getline(1, '$'))
+ call assert_equal(1, &modifiable)
+
+ delfunc Foo
+ bw!
+ endfunc
+
func Test_nocatch_sub_failure_handling()
" normal error results in all replacements
! func Foo()
foobar
endfunc
new
***************
*** 649,654 ****
--- 664,670 ----
call assert_equal(1, error_caught)
call assert_equal(['1 aaa', '2 aaa', '3 aaa'], getline(1, 3))
+ delfunc Foo
bwipe!
endfunc
*** ../vim-8.1.1359/src/version.c 2019-05-19 22:53:36.508914587 +0200
--- src/version.c 2019-05-20 20:34:12.939969595 +0200
***************
*** 769,770 ****
--- 769,772 ----
{ /* Add new patch number below this line */
+ /**/
+ 1360,
/**/
--
Contrary to popular belief, it's often your clothing that gets promoted, not
you.
(Scott Adams - The Dilbert principle)
/// Bram Moolenaar -- [email protected] -- 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 ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/201905201835.x4KIZE8J005008%40masaka.moolenaar.net.
For more options, visit https://groups.google.com/d/optout.