summaryrefslogtreecommitdiff
path: root/data/vim/patches/8.1.1360
blob: 4d27d29f7d0f29bf0ff43b029a2da798e2d88aec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
To: vim_dev@googlegroups.com
Subject: Patch 8.1.1360
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.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(&regmatch,
--- 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 -- 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    ///