summaryrefslogtreecommitdiff
path: root/data/vim/patches/8.1.0275
blob: 6617c72f01a88caa2fff52da26175e9a4c8f8e0c (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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
To: vim_dev@googlegroups.com
Subject: Patch 8.1.0275
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.0275
Problem:    'incsearch' with :s doesn't start at cursor line.
Solution:   Set cursor before parsing address. (closes #3318)
            Also accept a match at the start of the first line.
Files:	    src/ex_getln.c, src/testdir/test_search.vim


*** ../vim-8.1.0274/src/ex_getln.c	2018-08-11 19:20:45.042561404 +0200
--- src/ex_getln.c	2018-08-12 15:48:20.176044564 +0200
***************
*** 316,323 ****
  			ea.line2 = 1;
  			ea.cmd = ccline.cmdbuff;
  			ea.addr_type = ADDR_LINES;
- 			parse_cmd_address(&ea, &dummy);
  			curwin->w_cursor = is_state->search_start;
  			if (ea.addr_count > 0)
  			{
  			    search_first_line = ea.line1;
--- 316,323 ----
  			ea.line2 = 1;
  			ea.cmd = ccline.cmdbuff;
  			ea.addr_type = ADDR_LINES;
  			curwin->w_cursor = is_state->search_start;
+ 			parse_cmd_address(&ea, &dummy);
  			if (ea.addr_count > 0)
  			{
  			    search_first_line = ea.line1;
***************
*** 401,406 ****
--- 401,408 ----
  #endif
  	if (!p_hls)
  	    search_flags += SEARCH_KEEP;
+ 	if (search_first_line != 0)
+ 	    search_flags += SEARCH_START;
  	c = ccline.cmdbuff[skiplen + patlen];
  	ccline.cmdbuff[skiplen + patlen] = NUL;
  	i = do_search(NULL, firstc == ':' ? '/' : firstc,
*** ../vim-8.1.0274/src/testdir/test_search.vim	2018-08-11 19:20:45.042561404 +0200
--- src/testdir/test_search.vim	2018-08-12 15:24:06.430745257 +0200
***************
*** 351,357 ****
    set incsearch
  endfunc
  
! func Cmdline3_cleanup()
    set noincsearch
    call test_override("char_avail", 0)
    bw!
--- 351,357 ----
    set incsearch
  endfunc
  
! func Incsearch_cleanup()
    set noincsearch
    call test_override("char_avail", 0)
    bw!
***************
*** 367,373 ****
    call feedkeys("/the\<c-l>\<cr>", 'tx')
    call assert_equal('  2 the~e', getline('.'))
  
!   call Cmdline3_cleanup()
  endfunc
  
  func Test_search_cmdline3s()
--- 367,373 ----
    call feedkeys("/the\<c-l>\<cr>", 'tx')
    call assert_equal('  2 the~e', getline('.'))
  
!   call Incsearch_cleanup()
  endfunc
  
  func Test_search_cmdline3s()
***************
*** 385,391 ****
    call feedkeys(":%substitute/the\<c-l>/xxx\<cr>", 'tx')
    call assert_equal('  2 xxxe', getline('.'))
  
!   call Cmdline3_cleanup()
  endfunc
  
  func Test_search_cmdline3g()
--- 385,391 ----
    call feedkeys(":%substitute/the\<c-l>/xxx\<cr>", 'tx')
    call assert_equal('  2 xxxe', getline('.'))
  
!   call Incsearch_cleanup()
  endfunc
  
  func Test_search_cmdline3g()
***************
*** 400,406 ****
    call feedkeys(":global/the\<c-l>/d\<cr>", 'tx')
    call assert_equal('  3 the theother', getline(2))
  
!   call Cmdline3_cleanup()
  endfunc
  
  func Test_search_cmdline3v()
--- 400,406 ----
    call feedkeys(":global/the\<c-l>/d\<cr>", 'tx')
    call assert_equal('  3 the theother', getline(2))
  
!   call Incsearch_cleanup()
  endfunc
  
  func Test_search_cmdline3v()
***************
*** 417,423 ****
    call assert_equal(1, line('$'))
    call assert_equal('  2 the~e', getline(1))
  
!   call Cmdline3_cleanup()
  endfunc
  
  func Test_search_cmdline4()
--- 417,423 ----
    call assert_equal(1, line('$'))
    call assert_equal('  2 the~e', getline(1))
  
!   call Incsearch_cleanup()
  endfunc
  
  func Test_search_cmdline4()
***************
*** 797,802 ****
--- 797,823 ----
    call delete('Xscript')
  endfunc
  
+ func Test_incsearch_substitute()
+   if !exists('+incsearch')
+     return
+   endif
+   call test_override("char_avail", 1)
+   new
+   set incsearch
+   for n in range(1, 10)
+     call setline(n, 'foo ' . n)
+   endfor
+   4
+   call feedkeys(":.,.+2s/foo\<BS>o\<BS>o/xxx\<cr>", 'tx')
+   call assert_equal('foo 3', getline(3))
+   call assert_equal('xxx 4', getline(4))
+   call assert_equal('xxx 5', getline(5))
+   call assert_equal('xxx 6', getline(6))
+   call assert_equal('foo 7', getline(7))
+ 
+   call Incsearch_cleanup()
+ endfunc
+ 
  func Test_search_undefined_behaviour()
    if !has("terminal")
      return
*** ../vim-8.1.0274/src/version.c	2018-08-11 19:20:45.042561404 +0200
--- src/version.c	2018-08-12 15:29:30.772309260 +0200
***************
*** 796,797 ****
--- 796,799 ----
  {   /* Add new patch number below this line */
+ /**/
+     275,
  /**/

-- 
Any sufficiently advanced technology is indistinguishable from magic.
					Arthur C. Clarke
Any sufficiently advanced bug is indistinguishable from a feature.
                                        Rich Kulawiec

 /// 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    ///