summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ex_cmds.c2
-rw-r--r--src/testdir/test_substitute.vim18
-rw-r--r--src/version.c2
3 files changed, 20 insertions, 2 deletions
diff --git a/src/ex_cmds.c b/src/ex_cmds.c
index df5dcd01f..0174fd6b0 100644
--- a/src/ex_cmds.c
+++ b/src/ex_cmds.c
@@ -5557,6 +5557,7 @@ do_sub(exarg_T *eap)
* 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,7 +5567,6 @@ do_sub(exarg_T *eap)
// 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,
diff --git a/src/testdir/test_substitute.vim b/src/testdir/test_substitute.vim
index 06bdc243d..344bb68da 100644
--- a/src/testdir/test_substitute.vim
+++ b/src/testdir/test_substitute.vim
@@ -611,9 +611,24 @@ func Test_sub_cmd_8()
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()
+ func Foo()
foobar
endfunc
new
@@ -649,6 +664,7 @@ func Test_nocatch_sub_failure_handling()
call assert_equal(1, error_caught)
call assert_equal(['1 aaa', '2 aaa', '3 aaa'], getline(1, 3))
+ delfunc Foo
bwipe!
endfunc
diff --git a/src/version.c b/src/version.c
index f9962a0cf..01a0b0d62 100644
--- a/src/version.c
+++ b/src/version.c
@@ -768,6 +768,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1360,
+/**/
1359,
/**/
1358,