blob: da5f6f5c382a1100efa133a479cbdc7e911e6f65 [file] [log] [blame]
Bram Moolenaar9aa15692017-08-19 15:05:32 +02001" Tests for 'virtualedit'.
2
3func Test_yank_move_change()
Bram Moolenaard41babe2017-08-30 17:01:35 +02004 new
Bram Moolenaar9aa15692017-08-19 15:05:32 +02005 call setline(1, [
6 \ "func foo() error {",
7 \ "\tif n, err := bar();",
8 \ "\terr != nil {",
9 \ "\t\treturn err",
10 \ "\t}",
11 \ "\tn = n * n",
12 \ ])
13 set virtualedit=all
14 set ts=4
15 function! MoveSelectionDown(count) abort
16 normal! m`
17 silent! exe "'<,'>move'>+".a:count
18 norm! ``
19 endfunction
20
21 xmap ]e :<C-U>call MoveSelectionDown(v:count1)<CR>
22 2
23 normal 2gg
24 normal J
25 normal jVj
26 normal ]e
27 normal ce
28 bwipe!
29 set virtualedit=
30 set ts=8
31endfunc
Bram Moolenaard41babe2017-08-30 17:01:35 +020032
33func Test_paste_end_of_line()
34 new
35 set virtualedit=all
36 call setline(1, ['456', '123'])
37 normal! gg0"ay$
38 exe "normal! 2G$lllA\<C-O>:normal! \"agP\r"
39 call assert_equal('123456', getline(2))
40
41 bwipe!
42 set virtualedit=
43endfunc
Bram Moolenaardb0eede2018-04-25 22:38:17 +020044
Bram Moolenaar630afe82018-06-28 19:26:28 +020045func Test_replace_end_of_line()
46 new
47 set virtualedit=all
48 call setline(1, range(20))
49 exe "normal! gg2jv10lr-"
50 call assert_equal(["1", "-----------", "3"], getline(2,4))
Bram Moolenaar30276f22019-01-24 17:59:39 +010051 call setline(1, range(20))
52 exe "normal! gg2jv10lr\<c-k>hh"
53 call assert_equal(["1", "───────────", "3"], getline(2,4))
Bram Moolenaar630afe82018-06-28 19:26:28 +020054
55 bwipe!
56 set virtualedit=
57endfunc
58
Bram Moolenaardb0eede2018-04-25 22:38:17 +020059func Test_edit_CTRL_G()
60 new
61 set virtualedit=insert
62 call setline(1, ['123', '1', '12'])
63 exe "normal! ggA\<c-g>jx\<c-g>jx"
64 call assert_equal(['123', '1 x', '12 x'], getline(1,'$'))
65
66 set virtualedit=all
67 %d_
68 call setline(1, ['1', '12'])
69 exe "normal! ggllix\<c-g>jx"
70 call assert_equal(['1 x', '12x'], getline(1,'$'))
71
72
73 bwipe!
74 set virtualedit=
75endfunc
Bram Moolenaar77ccc002019-10-31 03:21:25 +010076
77func Test_edit_change()
78 new
79 set virtualedit=all
80 call setline(1, "\t⒌")
81 normal Cx
82 call assert_equal('x', getline(1))
Bram Moolenaar3e72dca2021-05-29 16:30:12 +020083 " Do a visual block change
84 call setline(1, ['a', 'b', 'c'])
85 exe "normal gg3l\<C-V>2jcx"
86 call assert_equal(['a x', 'b x', 'c x'], getline(1, '$'))
Bram Moolenaar77ccc002019-10-31 03:21:25 +010087 bwipe!
Bram Moolenaar6f1f0ca2019-12-01 18:16:18 +010088 set virtualedit=
89endfunc
90
Bram Moolenaarc99cbf82023-03-04 14:13:10 +000091func Test_edit_special_char()
92 new
93 se ve=all
94 norm a0
95 sil! exe "norm o00000\<Nul>k<a0s"
96
97 bwipe!
98 set virtualedit=
99endfunc
100
Bram Moolenaar54c8d222019-12-02 20:41:39 +0100101" Tests for pasting at the beginning, end and middle of a tab character
102" in virtual edit mode.
Bram Moolenaar6f1f0ca2019-12-01 18:16:18 +0100103func Test_paste_in_tab()
104 new
Bram Moolenaar54c8d222019-12-02 20:41:39 +0100105 call append(0, '')
Bram Moolenaar6f1f0ca2019-12-01 18:16:18 +0100106 set virtualedit=all
Bram Moolenaar54c8d222019-12-02 20:41:39 +0100107
108 " Tests for pasting a register with characterwise mode type
109 call setreg('"', 'xyz', 'c')
110
111 " paste (p) unnamed register at the beginning of a tab
Bram Moolenaar6f1f0ca2019-12-01 18:16:18 +0100112 call setline(1, "a\tb")
Bram Moolenaar54c8d222019-12-02 20:41:39 +0100113 call cursor(1, 2, 0)
114 normal p
115 call assert_equal('a xyz b', getline(1))
116
117 " paste (P) unnamed register at the beginning of a tab
118 call setline(1, "a\tb")
119 call cursor(1, 2, 0)
Bram Moolenaar6f1f0ca2019-12-01 18:16:18 +0100120 normal P
121 call assert_equal("axyz\tb", getline(1))
122
Bram Moolenaar54c8d222019-12-02 20:41:39 +0100123 " paste (p) unnamed register at the end of a tab
Bram Moolenaar6f1f0ca2019-12-01 18:16:18 +0100124 call setline(1, "a\tb")
125 call cursor(1, 2, 6)
126 normal p
127 call assert_equal("a\txyzb", getline(1))
Bram Moolenaar54c8d222019-12-02 20:41:39 +0100128
129 " paste (P) unnamed register at the end of a tab
Bram Moolenaar6f1f0ca2019-12-01 18:16:18 +0100130 call setline(1, "a\tb")
131 call cursor(1, 2, 6)
132 normal P
Bram Moolenaar54c8d222019-12-02 20:41:39 +0100133 call assert_equal('a xyz b', getline(1))
Bram Moolenaar6f1f0ca2019-12-01 18:16:18 +0100134
Bram Moolenaar54c8d222019-12-02 20:41:39 +0100135 " Tests for pasting a register with blockwise mode type
136 call setreg('"', 'xyz', 'b')
137
138 " paste (p) unnamed register at the beginning of a tab
139 call setline(1, "a\tb")
140 call cursor(1, 2, 0)
141 normal p
142 call assert_equal('a xyz b', getline(1))
143
144 " paste (P) unnamed register at the beginning of a tab
145 call setline(1, "a\tb")
146 call cursor(1, 2, 0)
147 normal P
148 call assert_equal("axyz\tb", getline(1))
149
150 " paste (p) unnamed register at the end of a tab
151 call setline(1, "a\tb")
152 call cursor(1, 2, 6)
153 normal p
154 call assert_equal("a\txyzb", getline(1))
155
156 " paste (P) unnamed register at the end of a tab
157 call setline(1, "a\tb")
158 call cursor(1, 2, 6)
159 normal P
160 call assert_equal('a xyz b', getline(1))
161
162 " Tests for pasting with gp and gP in virtual edit mode
163
164 " paste (gp) unnamed register at the beginning of a tab
165 call setline(1, "a\tb")
166 call cursor(1, 2, 0)
167 normal gp
168 call assert_equal('a xyz b', getline(1))
169 call assert_equal([0, 1, 12, 0, 12], getcurpos())
170
171 " paste (gP) unnamed register at the beginning of a tab
172 call setline(1, "a\tb")
173 call cursor(1, 2, 0)
174 normal gP
175 call assert_equal("axyz\tb", getline(1))
176 call assert_equal([0, 1, 5, 0, 5], getcurpos())
177
178 " paste (gp) unnamed register at the end of a tab
Bram Moolenaar6f1f0ca2019-12-01 18:16:18 +0100179 call setline(1, "a\tb")
180 call cursor(1, 2, 6)
181 normal gp
182 call assert_equal("a\txyzb", getline(1))
183 call assert_equal([0, 1, 6, 0, 12], getcurpos())
Bram Moolenaar54c8d222019-12-02 20:41:39 +0100184
185 " paste (gP) unnamed register at the end of a tab
Bram Moolenaar6f1f0ca2019-12-01 18:16:18 +0100186 call setline(1, "a\tb")
187 call cursor(1, 2, 6)
188 normal gP
Bram Moolenaar54c8d222019-12-02 20:41:39 +0100189 call assert_equal('a xyz b', getline(1))
190 call assert_equal([0, 1, 12, 0, 12], getcurpos())
191
192 " Tests for pasting a named register
193 let @r = 'xyz'
194
195 " paste (gp) named register in the middle of a tab
196 call setline(1, "a\tb")
197 call cursor(1, 2, 2)
198 normal "rgp
199 call assert_equal('a xyz b', getline(1))
200 call assert_equal([0, 1, 8, 0, 8], getcurpos())
201
202 " paste (gP) named register in the middle of a tab
203 call setline(1, "a\tb")
204 call cursor(1, 2, 2)
205 normal "rgP
206 call assert_equal('a xyz b', getline(1))
207 call assert_equal([0, 1, 7, 0, 7], getcurpos())
Bram Moolenaar6f1f0ca2019-12-01 18:16:18 +0100208
209 bwipe!
210 set virtualedit=
Bram Moolenaar77ccc002019-10-31 03:21:25 +0100211endfunc
Bram Moolenaar54c8d222019-12-02 20:41:39 +0100212
213" Test for yanking a few spaces within a tab to a register
214func Test_yank_in_tab()
215 new
216 let @r = ''
217 call setline(1, "a\tb")
218 set virtualedit=all
219 call cursor(1, 2, 2)
220 normal "ry5l
221 call assert_equal(' ', @r)
222
223 bwipe!
224 set virtualedit=
225endfunc
226
Bram Moolenaar079119b2019-12-03 22:59:23 +0100227" Insert "keyword keyw", ESC, C CTRL-N, shows "keyword ykeyword".
228" Repeating CTRL-N fixes it. (Mary Ellen Foster)
229func Test_ve_completion()
230 new
231 set completeopt&vim
232 set virtualedit=all
233 exe "normal ikeyword keyw\<Esc>C\<C-N>"
234 call assert_equal('keyword keyword', getline(1))
235 bwipe!
236 set virtualedit=
237endfunc
238
239" Using "C" then then <CR> moves the last remaining character to the next
240" line. (Mary Ellen Foster)
241func Test_ve_del_to_eol()
242 new
243 set virtualedit=all
244 call append(0, 'all your base are belong to us')
245 call search('are', 'w')
246 exe "normal C\<CR>are belong to vim"
247 call assert_equal(['all your base ', 'are belong to vim'], getline(1, 2))
248 bwipe!
249 set virtualedit=
250endfunc
251
252" When past the end of a line that ends in a single character "b" skips
253" that word.
254func Test_ve_b_past_eol()
255 new
256 set virtualedit=all
257 call append(0, '1 2 3 4 5 6')
258 normal gg^$15lbC7
259 call assert_equal('1 2 3 4 5 7', getline(1))
260 bwipe!
261 set virtualedit=
262endfunc
263
264" Make sure 'i', 'C', 'a', 'A' and 'D' works
265func Test_ve_ins_del()
266 new
267 set virtualedit=all
268 call append(0, ["'i'", "'C'", "'a'", "'A'", "'D'"])
269 call cursor(1, 1)
270 normal $4lix
271 call assert_equal("'i' x", getline(1))
272 call cursor(2, 1)
273 normal $4lCx
274 call assert_equal("'C' x", getline(2))
275 call cursor(3, 1)
276 normal $4lax
277 call assert_equal("'a' x", getline(3))
278 call cursor(4, 1)
279 normal $4lAx
280 call assert_equal("'A'x", getline(4))
281 call cursor(5, 1)
282 normal $4lDix
283 call assert_equal("'D' x", getline(5))
284 bwipe!
285 set virtualedit=
286endfunc
287
288" Test for yank bug reported by Mark Waggoner.
289func Test_yank_block()
290 new
291 set virtualedit=block
292 call append(0, repeat(['this is a test'], 3))
293 exe "normal gg^2w\<C-V>3jy"
294 call assert_equal("a\na\na\n ", @")
295 bwipe!
296 set virtualedit=
297endfunc
298
299" Test "r" beyond the end of the line
300func Test_replace_after_eol()
301 new
302 set virtualedit=all
303 call append(0, '"r"')
304 normal gg$5lrxa
305 call assert_equal('"r" x', getline(1))
Bram Moolenaar3e72dca2021-05-29 16:30:12 +0200306 " visual block replace
307 %d _
308 call setline(1, ['a', '', 'b'])
309 exe "normal 2l\<C-V>2jrx"
310 call assert_equal(['a x', ' x', 'b x'], getline(1, '$'))
311 " visual characterwise selection replace after eol
312 %d _
313 call setline(1, 'a')
314 normal 4lv2lrx
315 call assert_equal('a xxx', getline(1))
Bram Moolenaar079119b2019-12-03 22:59:23 +0100316 bwipe!
317 set virtualedit=
318endfunc
319
320" Test "r" on a tab
321" Note that for this test, 'ts' must be 8 (the default).
322func Test_replace_on_tab()
323 new
324 set virtualedit=all
325 call append(0, "'r'\t")
326 normal gg^5lrxAy
327 call assert_equal("'r' x y", getline(1))
Bram Moolenaarf5f1e102020-03-08 05:13:15 +0100328 call setline(1, 'aaaaaaaaaaaa')
329 exe "normal! gg2lgR\<Tab>"
330 call assert_equal("aa\taaaa", getline(1))
Bram Moolenaar079119b2019-12-03 22:59:23 +0100331 bwipe!
332 set virtualedit=
333endfunc
334
335" Test to make sure 'x' can delete control characters
336func Test_ve_del_ctrl_chars()
337 new
338 set virtualedit=all
339 call append(0, "a\<C-V>b\<CR>sd")
340 set display=uhex
341 normal gg^xxxxxxi[text]
342 set display=
343 call assert_equal('[text]', getline(1))
344 bwipe!
345 set virtualedit=
346endfunc
347
348" Test for ^Y/^E due to bad w_virtcol value, reported by
349" Roy <royl@netropolis.net>.
350func Test_ins_copy_char()
351 new
352 set virtualedit=all
353 call append(0, 'abcv8efi.him2kl')
354 exe "normal gg^O\<Esc>3li\<C-E>\<Esc>4li\<C-E>\<Esc>4li\<C-E> <--"
355 exe "normal j^o\<Esc>4li\<C-Y>\<Esc>4li\<C-Y>\<Esc>4li\<C-Y> <--"
356 call assert_equal(' v i m <--', getline(1))
357 call assert_equal(' 8 . 2 <--', getline(3))
358 bwipe!
359 set virtualedit=
360endfunc
361
362" Test for yanking and pasting using the small delete register
363func Test_yank_paste_small_del_reg()
364 new
365 set virtualedit=all
366 call append(0, "foo, bar")
367 normal ggdewve"-p
368 call assert_equal(', foo', getline(1))
369 bwipe!
370 set virtualedit=
371endfunc
372
Bram Moolenaar004a6782020-04-11 17:09:31 +0200373" Test for delete that breaks a tab into spaces
374func Test_delete_break_tab()
375 new
376 call setline(1, "one\ttwo")
377 set virtualedit=all
378 normal v3ld
379 call assert_equal(' two', getline(1))
380 set virtualedit&
381 close!
382endfunc
383
Bram Moolenaar845e0ee2020-06-20 16:05:32 +0200384" Test for using <BS>, <C-W> and <C-U> in virtual edit mode
385" to erase character, word and line.
386func Test_ve_backspace()
387 new
388 call setline(1, 'sample')
389 set virtualedit=all
390 set backspace=indent,eol,start
391 exe "normal 15|i\<BS>\<BS>"
392 call assert_equal([0, 1, 7, 5], getpos('.'))
393 exe "normal 15|i\<C-W>"
394 call assert_equal([0, 1, 6, 0], getpos('.'))
395 exe "normal 15|i\<C-U>"
396 call assert_equal([0, 1, 1, 0], getpos('.'))
397 set backspace&
398 set virtualedit&
399 close!
400endfunc
401
Bram Moolenaar3e72dca2021-05-29 16:30:12 +0200402" Test for delete (x) on EOL character and after EOL
403func Test_delete_past_eol()
404 new
405 call setline(1, "ab")
406 set virtualedit=all
407 exe "normal 2lx"
408 call assert_equal('ab', getline(1))
409 exe "normal 10lx"
410 call assert_equal('ab', getline(1))
411 set virtualedit&
412 bw!
413endfunc
414
Gary Johnson53ba05b2021-07-26 22:19:10 +0200415" After calling s:TryVirtualeditReplace(), line 1 will contain one of these
416" two strings, depending on whether virtual editing is on or off.
417let s:result_ve_on = 'a x'
418let s:result_ve_off = 'x'
419
Gary Johnson51ad8502021-08-03 18:33:08 +0200420" Utility function for Test_global_local_virtualedit()
Gary Johnson53ba05b2021-07-26 22:19:10 +0200421func s:TryVirtualeditReplace()
422 call setline(1, 'a')
423 normal gg7l
424 normal rx
425endfunc
426
427" Test for :set and :setlocal
Gary Johnson51ad8502021-08-03 18:33:08 +0200428func Test_global_local_virtualedit()
Gary Johnson53ba05b2021-07-26 22:19:10 +0200429 new
430
431 " Verify that 'virtualedit' is initialized to empty, can be set globally to
432 " all and to empty, and can be set locally to all and to empty.
433 call s:TryVirtualeditReplace()
434 call assert_equal(s:result_ve_off, getline(1))
435 set ve=all
436 call s:TryVirtualeditReplace()
437 call assert_equal(s:result_ve_on, getline(1))
438 set ve=
439 call s:TryVirtualeditReplace()
440 call assert_equal(s:result_ve_off, getline(1))
441 setlocal ve=all
442 call s:TryVirtualeditReplace()
443 call assert_equal(s:result_ve_on, getline(1))
444 setlocal ve=
445 call s:TryVirtualeditReplace()
446 call assert_equal(s:result_ve_off, getline(1))
447
Gary Johnson51ad8502021-08-03 18:33:08 +0200448 " Verify that :set affects multiple windows.
449 split
Gary Johnson53ba05b2021-07-26 22:19:10 +0200450 set ve=all
451 call s:TryVirtualeditReplace()
452 call assert_equal(s:result_ve_on, getline(1))
453 wincmd p
454 call s:TryVirtualeditReplace()
455 call assert_equal(s:result_ve_on, getline(1))
456 set ve=
457 wincmd p
458 call s:TryVirtualeditReplace()
459 call assert_equal(s:result_ve_off, getline(1))
460 bwipe!
461
Gary Johnson51ad8502021-08-03 18:33:08 +0200462 " Verify that :setlocal affects only the current window.
Gary Johnson53ba05b2021-07-26 22:19:10 +0200463 new
Gary Johnson51ad8502021-08-03 18:33:08 +0200464 split
Gary Johnson53ba05b2021-07-26 22:19:10 +0200465 setlocal ve=all
Gary Johnson53ba05b2021-07-26 22:19:10 +0200466 call s:TryVirtualeditReplace()
467 call assert_equal(s:result_ve_on, getline(1))
Gary Johnson51ad8502021-08-03 18:33:08 +0200468 wincmd p
469 call s:TryVirtualeditReplace()
470 call assert_equal(s:result_ve_off, getline(1))
Gary Johnson53ba05b2021-07-26 22:19:10 +0200471 bwipe!
472 call s:TryVirtualeditReplace()
473 call assert_equal(s:result_ve_off, getline(1))
474
475 " Verify that the buffer 'virtualedit' state follows the global value only
476 " when empty and that "none" works as expected.
477 "
478 " 'virtualedit' State
479 " +--------+--------------------------+
480 " | Local | Global |
481 " | | |
482 " +--------+--------+--------+--------+
483 " | | "" | "all" | "none" |
484 " +--------+--------+--------+--------+
485 " | "" | off | on | off |
486 " | "all" | on | on | on |
487 " | "none" | off | off | off |
488 " +--------+--------+--------+--------+
489 new
490
491 setglobal ve=
492 setlocal ve=
493 call s:TryVirtualeditReplace()
494 call assert_equal(s:result_ve_off, getline(1))
495 setlocal ve=all
496 call s:TryVirtualeditReplace()
497 call assert_equal(s:result_ve_on, getline(1))
498 setlocal ve=none
499 call s:TryVirtualeditReplace()
500 call assert_equal(s:result_ve_off, getline(1))
501
502 setglobal ve=all
503 setlocal ve=
504 call s:TryVirtualeditReplace()
505 call assert_equal(s:result_ve_on, getline(1))
506 setlocal ve=all
507 call s:TryVirtualeditReplace()
508 call assert_equal(s:result_ve_on, getline(1))
509 setlocal ve=none
510 call s:TryVirtualeditReplace()
511 call assert_equal(s:result_ve_off, getline(1))
512 setlocal ve=NONE
513 call s:TryVirtualeditReplace()
514 call assert_equal(s:result_ve_off, getline(1))
515
516 setglobal ve=none
517 setlocal ve=
518 call s:TryVirtualeditReplace()
519 call assert_equal(s:result_ve_off, getline(1))
520 setlocal ve=all
521 call s:TryVirtualeditReplace()
522 call assert_equal(s:result_ve_on, getline(1))
523 setlocal ve=none
524 call s:TryVirtualeditReplace()
525 call assert_equal(s:result_ve_off, getline(1))
526
527 bwipe!
528
Gary Johnson51ad8502021-08-03 18:33:08 +0200529 " Verify that the 'virtualedit' state is copied to new windows.
530 new
531 call s:TryVirtualeditReplace()
532 call assert_equal(s:result_ve_off, getline(1))
533 split
534 setlocal ve=all
535 call s:TryVirtualeditReplace()
536 call assert_equal(s:result_ve_on, getline(1))
537 split
538 call s:TryVirtualeditReplace()
539 call assert_equal(s:result_ve_on, getline(1))
540 setlocal ve=
541 split
542 call s:TryVirtualeditReplace()
543 call assert_equal(s:result_ve_off, getline(1))
544 bwipe!
545
Gary Johnson53ba05b2021-07-26 22:19:10 +0200546 setlocal virtualedit&
547 set virtualedit&
548endfunc
549
Bram Moolenaar8fe5b9c2023-01-28 16:37:37 +0000550func Test_virtualedit_setlocal()
551 enew
552 setglobal virtualedit=all
553 setlocal virtualedit=all
554 normal! l
555 redraw
556 setlocal virtualedit=none
557 call assert_equal(1, wincol())
558
559 setlocal virtualedit&
560 set virtualedit&
561endfunc
562
Bram Moolenaar8f49e692022-08-09 14:19:40 +0100563func Test_virtualedit_mouse()
564 let save_mouse = &mouse
565 set mouse=a
566 set virtualedit=all
567 new
568
569 call setline(1, ["text\tword"])
570 redraw
571 call test_setmouse(1, 4)
572 call feedkeys("\<LeftMouse>", "xt")
573 call assert_equal([0, 1, 4, 0, 4], getcurpos())
574 call test_setmouse(1, 5)
575 call feedkeys("\<LeftMouse>", "xt")
576 call assert_equal([0, 1, 5, 0, 5], getcurpos())
577 call test_setmouse(1, 6)
578 call feedkeys("\<LeftMouse>", "xt")
579 call assert_equal([0, 1, 5, 1, 6], getcurpos())
580 call test_setmouse(1, 7)
581 call feedkeys("\<LeftMouse>", "xt")
582 call assert_equal([0, 1, 5, 2, 7], getcurpos())
583 call test_setmouse(1, 8)
584 call feedkeys("\<LeftMouse>", "xt")
585 call assert_equal([0, 1, 5, 3, 8], getcurpos())
586 call test_setmouse(1, 9)
587 call feedkeys("\<LeftMouse>", "xt")
588 call assert_equal([0, 1, 6, 0, 9], getcurpos())
zeertzjqe500ae82023-08-17 22:35:26 +0200589 call test_setmouse(1, 12)
590 call feedkeys("\<LeftMouse>", "xt")
591 call assert_equal([0, 1, 9, 0, 12], getcurpos())
592 call test_setmouse(1, 13)
593 call feedkeys("\<LeftMouse>", "xt")
594 call assert_equal([0, 1, 10, 0, 13], getcurpos())
Bram Moolenaar8f49e692022-08-09 14:19:40 +0100595 call test_setmouse(1, 15)
596 call feedkeys("\<LeftMouse>", "xt")
597 call assert_equal([0, 1, 10, 2, 15], getcurpos())
598
599 bwipe!
600 let &mouse = save_mouse
601 set virtualedit&
602endfunc
603
Bram Moolenaar94722c52023-01-28 19:19:03 +0000604" this was replacing the NUL at the end of the line
Bram Moolenaarc2499132022-09-16 22:16:59 +0100605func Test_virtualedit_replace_after_tab()
606 new
607 s/\v/ 0
608 set ve=all
609 let @" = ''
610 sil! norm vPvr0
Bram Moolenaar94722c52023-01-28 19:19:03 +0000611
Bram Moolenaarc2499132022-09-16 22:16:59 +0100612 call assert_equal("\t0", getline(1))
613 set ve&
614 bwipe!
615endfunc
616
617
Bram Moolenaar54c8d222019-12-02 20:41:39 +0100618" vim: shiftwidth=2 sts=2 expandtab